Skip to contentSkip to conversation

ptrace_get_syscall_info-factor-out-ptrace_get_syscall_info_op.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 12, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op
has been removed from the -mm tree. Its filename was
ptrace_get_syscall_info-factor-out-ptrace_get_syscall_info_op.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Dmitry V. Levin" <[email protected]>
Subject: ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op
Date: Mon, 3 Mar 2025 13:20:38 +0200

Move the code that calculates the type of the system call stop out of ptrace_get_syscall_info() into a separate function ptrace_get_syscall_info_op() which is going to be used later to implement PTRACE_SET_SYSCALL_INFO API.

Cc Alexander Gordeev <[email protected]>
Cc Alexey Gladkov (Intel) <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc anton ivanov <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc Brian Cain <[email protected]>
Cc Charlie Jenkins <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Christian Zankel <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Davide Berardi <[email protected]>
Cc David S. Miller <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Eugene Syromiatnikov <[email protected]>
Cc Eugene Syromyatnikov <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Guo Ren <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Helge Deller <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Huacai Chen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Johannes Berg <[email protected]>
Cc John Paul Adrian Glaubitz <[email protected]>
Cc Jonas Bonn <[email protected]>
Cc Maciej W. Rozycki <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Max Filippov <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Simek <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc Naveen N Rao <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Renzo Davoi <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Rich Felker <[email protected]>
Cc Russel King <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Stafford Horne <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Sven Schnelle <[email protected]>
Cc Thomas Gleinxer <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vineet Gupta <[email protected]>
Cc WANG Xuerui <[email protected]>
Cc Will Deacon <[email protected]>
Cc Yoshinori Sato <[email protected]>

---

 kernel/ptrace.c |   58 ++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 24 deletions(-)
kernel/ptrace.c renamed from kernel/ptrace.c~ptrace_get_syscall_info-factor-out-ptrace_get_syscall_info_op +34 -24
@@ -921,7 +921,6 @@ ptrace_get_syscall_info_entry(struct tas
 	unsigned long args[ARRAY_SIZE(info->entry.args)];
 	int i;
 
-	info->op = PTRACE_SYSCALL_INFO_ENTRY;
 	info->entry.nr = syscall_get_nr(child, regs);
 	syscall_get_arguments(child, regs, args);
 	for (i = 0; i < ARRAY_SIZE(args); i++)
@@ -943,7 +942,6 @@ ptrace_get_syscall_info_seccomp(struct t
 	 * diverge significantly enough.
 	 */
 	ptrace_get_syscall_info_entry(child, regs, info);
-	info->op = PTRACE_SYSCALL_INFO_SECCOMP;
 	info->seccomp.ret_data = child->ptrace_message;
 
 	/* ret_data is the last field in struct ptrace_syscall_info.seccomp */
@@ -954,7 +952,6 @@ static unsigned long
 ptrace_get_syscall_info_exit(struct task_struct *child, struct pt_regs *regs,
 			     struct ptrace_syscall_info *info)
 {
-	info->op = PTRACE_SYSCALL_INFO_EXIT;
 	info->exit.rval = syscall_get_error(child, regs);
 	info->exit.is_error = !!info->exit.rval;
 	if (!info->exit.is_error)
@@ -965,19 +962,8 @@ ptrace_get_syscall_info_exit(struct task
 }
 
 static int
-ptrace_get_syscall_info(struct task_struct *child, unsigned long user_size,
-			void __user *datavp)
+ptrace_get_syscall_info_op(struct task_struct *child)
 {
-	struct pt_regs *regs = task_pt_regs(child);
-	struct ptrace_syscall_info info = {
-		.op = PTRACE_SYSCALL_INFO_NONE,
-		.arch = syscall_get_arch(child),
-		.instruction_pointer = instruction_pointer(regs),
-		.stack_pointer = user_stack_pointer(regs),
-	};
-	unsigned long actual_size = offsetof(struct ptrace_syscall_info, entry);
-	unsigned long write_size;
-
 	/*
 	 * This does not need lock_task_sighand() to access
 	 * child->last_siginfo because ptrace_freeze_traced()
@@ -988,18 +974,42 @@ ptrace_get_syscall_info(struct task_stru
 	case SIGTRAP | 0x80:
 		switch (child->ptrace_message) {
 		case PTRACE_EVENTMSG_SYSCALL_ENTRY:
-			actual_size = ptrace_get_syscall_info_entry(child, regs,
-								    &info);
-			break;
+			return PTRACE_SYSCALL_INFO_ENTRY;
 		case PTRACE_EVENTMSG_SYSCALL_EXIT:
-			actual_size = ptrace_get_syscall_info_exit(child, regs,
-								   &info);
-			break;
+			return PTRACE_SYSCALL_INFO_EXIT;
+		default:
+			return PTRACE_SYSCALL_INFO_NONE;
 		}
-		break;
 	case SIGTRAP | (PTRACE_EVENT_SECCOMP << 8):
-		actual_size = ptrace_get_syscall_info_seccomp(child, regs,
-							      &info);
+		return PTRACE_SYSCALL_INFO_SECCOMP;
+	default:
+		return PTRACE_SYSCALL_INFO_NONE;
+	}
+}
+
+static int
+ptrace_get_syscall_info(struct task_struct *child, unsigned long user_size,
+			void __user *datavp)
+{
+	struct pt_regs *regs = task_pt_regs(child);
+	struct ptrace_syscall_info info = {
+		.op = ptrace_get_syscall_info_op(child),
+		.arch = syscall_get_arch(child),
+		.instruction_pointer = instruction_pointer(regs),
+		.stack_pointer = user_stack_pointer(regs),
+	};
+	unsigned long actual_size = offsetof(struct ptrace_syscall_info, entry);
+	unsigned long write_size;
+
+	switch (info.op) {
+	case PTRACE_SYSCALL_INFO_ENTRY:
+		actual_size = ptrace_get_syscall_info_entry(child, regs, &info);
+		break;
+	case PTRACE_SYSCALL_INFO_EXIT:
+		actual_size = ptrace_get_syscall_info_exit(child, regs, &info);
+		break;
+	case PTRACE_SYSCALL_INFO_SECCOMP:
+		actual_size = ptrace_get_syscall_info_seccomp(child, regs, &info);
 		break;
 	}
 

_

Patches currently in -mm which might be from [email protected] are