Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um/ptrace: Implement HAVE_SYSCALL_TRACEPOINTS

Implement syscall tracepoints through the generic tracing infrastructure.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://patch.msgid.link/20250703-uml-have_syscall_tracepoints-v1-2-23c1d3808578@linutronix.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Thomas Weißschuh and committed by
Johannes Berg
2a713f04 32a15664

+12
+1
arch/um/Kconfig
··· 35 35 select HAVE_RUST 36 36 select ARCH_HAS_UBSAN 37 37 select HAVE_ARCH_TRACEHOOK 38 + select HAVE_SYSCALL_TRACEPOINTS 38 39 select THREAD_INFO_IN_TASK 39 40 40 41 config MMU
+2
arch/um/include/asm/thread_info.h
··· 43 43 #define TIF_NOTIFY_RESUME 8 44 44 #define TIF_SECCOMP 9 /* secure computing */ 45 45 #define TIF_SINGLESTEP 10 /* single stepping userspace */ 46 + #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 47 + 46 48 47 49 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 48 50 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
+9
arch/um/kernel/ptrace.c
··· 9 9 #include <linux/uaccess.h> 10 10 #include <asm/ptrace-abi.h> 11 11 12 + #define CREATE_TRACE_POINTS 13 + #include <trace/events/syscalls.h> 14 + 12 15 void user_enable_single_step(struct task_struct *child) 13 16 { 14 17 set_tsk_thread_flag(child, TIF_SINGLESTEP); ··· 129 126 UPT_SYSCALL_ARG3(&regs->regs), 130 127 UPT_SYSCALL_ARG4(&regs->regs)); 131 128 129 + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 130 + trace_sys_enter(regs, UPT_SYSCALL_NR(&regs->regs)); 131 + 132 132 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 133 133 return 0; 134 134 ··· 147 141 /* Fake a debug trap */ 148 142 if (test_thread_flag(TIF_SINGLESTEP)) 149 143 send_sigtrap(&regs->regs, 0); 144 + 145 + if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 146 + trace_sys_exit(regs, PT_REGS_SYSCALL_RET(regs)); 150 147 151 148 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 152 149 return;