ptrace_get_syscall_info-factor-out-ptrace_get_syscall_info_op.patch removed from -mm tree
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.
---
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 tasunsigned 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_strucase 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