ptrace-introduce-ptrace_set_syscall_info-request.patch removed from -mm tree
The quilt patch titled
Subject: ptrace: introduce PTRACE_SET_SYSCALL_INFO request
has been removed from the -mm tree. Its filename was
ptrace-introduce-ptrace_set_syscall_info-request.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: introduce PTRACE_SET_SYSCALL_INFO request
Date: Mon, 3 Mar 2025 13:20:44 +0200
PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of system calls the tracee is blocked in.
This API allows ptracers to obtain and modify system call details in a straightforward and architecture-agnostic way, providing a consistent way of manipulating the system call number and arguments across architectures.
As in case of PTRACE_GET_SYSCALL_INFO, PTRACE_SET_SYSCALL_INFO also does not aim to address numerous architecture-specific system call ABI peculiarities, like differences in the number of system call arguments for such system calls as pread64 and preadv.
The current implementation supports changing only those bits of system call information that are used by strace system call tampering, namely, syscall number, syscall arguments, and syscall return value.
Support of changing additional details returned by PTRACE_GET_SYSCALL_INFO, such as instruction pointer and stack pointer, could be added later if needed, by using struct ptrace_syscall_info.flags to specify the additional details that should be set. Currently, "flags" and "reserved" fields of struct ptrace_syscall_info must be initialized with zeroes; "arch", "instruction_pointer", and "stack_pointer" fields are currently ignored.
PTRACE_SET_SYSCALL_INFO currently supports only PTRACE_SYSCALL_INFO_ENTRY, PTRACE_SYSCALL_INFO_EXIT, and PTRACE_SYSCALL_INFO_SECCOMP operations. Other operations could be added later if needed.
Ideally, PTRACE_SET_SYSCALL_INFO should have been introduced along with PTRACE_GET_SYSCALL_INFO, but it didn't happen. The last straw that convinced me to implement PTRACE_SET_SYSCALL_INFO was apparent failure to provide an API of changing the first system call argument on riscv architecture.
ptrace(2) man page:
long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data);
...PTRACE_SET_SYSCALL_INFO
Modify information about the system call that caused the stop. The "data" argument is a pointer to struct ptrace_syscall_info that specifies the system call information to be set.
The "addr" argument should be set to sizeof(struct ptrace_syscall_info)).
---
include/uapi/linux/ptrace.h | 7 + kernel/ptrace.c | 121 +++++++++++++++++++++++++++++++++- 2 files changed, 126 insertions(+), 2 deletions(-)
include/uapi/linux/ptrace.h renamed from include/uapi/linux/ptrace.h~ptrace-introduce-ptrace_set_syscall_info-request +6 -1
@@ -74,6 +74,7 @@ struct seccomp_metadata { };#define PTRACE_GET_SYSCALL_INFO 0x420e +#define PTRACE_SET_SYSCALL_INFO 0x4212#define PTRACE_SYSCALL_INFO_NONE 0#define PTRACE_SYSCALL_INFO_ENTRY 1#define PTRACE_SYSCALL_INFO_EXIT 2
@@ -81,7 +82,8 @@ struct seccomp_metadata {struct ptrace_syscall_info {__u8 op;/* PTRACE_SYSCALL_INFO_* */ -__u8 pad[3 ]; +__u8 reserved; +__u16 flags;__u32 arch;__u64 instruction_pointer;__u64 stack_pointer;
@@ -98,6 +100,7 @@ struct ptrace_syscall_info {__u64 nr;__u64 args[6 ];__u32 ret_data; +__u32 reserved2; } seccomp; }; };
@@ -142,6 +145,8 @@ struct ptrace_sud_config {__u64 len; }; +/* 0x4212 is PTRACE_SET_SYSCALL_INFO */ +/* * These values are stored in task->ptrace_message * by ptrace_stop to describe the current syscall-stop.
kernel/ptrace.c renamed from kernel/ptrace.c~ptrace-introduce-ptrace_set_syscall_info-request +120 -1
139 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are