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

ptrace: Remove tracehook_signal_handler

The two line function tracehook_signal_handler is only called from
signal_delivered. Expand it inline in signal_delivered and remove it.
Just to make it easier to understand what is going on.

Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20220309162454.123006-5-ebiederm@xmission.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

+2 -19
-1
arch/Kconfig
··· 219 219 # CORE_DUMP_USE_REGSET #define'd in linux/elf.h 220 220 # TIF_SYSCALL_TRACE calls ptrace_report_syscall_{entry,exit} 221 221 # TIF_NOTIFY_RESUME calls tracehook_notify_resume() 222 - # signal delivery calls tracehook_signal_handler() 223 222 # 224 223 config HAVE_ARCH_TRACEHOOK 225 224 bool
-17
include/linux/tracehook.h
··· 53 53 54 54 55 55 /** 56 - * tracehook_signal_handler - signal handler setup is complete 57 - * @stepping: nonzero if debugger single-step or block-step in use 58 - * 59 - * Called by the arch code after a signal handler has been set up. 60 - * Register and stack state reflects the user handler about to run. 61 - * Signal mask changes have already been made. 62 - * 63 - * Called without locks, shortly before returning to user mode 64 - * (or handling more signals). 65 - */ 66 - static inline void tracehook_signal_handler(int stepping) 67 - { 68 - if (stepping) 69 - ptrace_notify(SIGTRAP); 70 - } 71 - 72 - /** 73 56 * set_notify_resume - cause tracehook_notify_resume() to be called 74 57 * @task: task that will call tracehook_notify_resume() 75 58 *
+2 -1
kernel/signal.c
··· 2898 2898 set_current_blocked(&blocked); 2899 2899 if (current->sas_ss_flags & SS_AUTODISARM) 2900 2900 sas_ss_reset(current); 2901 - tracehook_signal_handler(stepping); 2901 + if (stepping) 2902 + ptrace_notify(SIGTRAP); 2902 2903 } 2903 2904 2904 2905 void signal_setup_done(int failed, struct ksignal *ksig, int stepping)