From 95b034e51e32bfbbf50609262a533befa6c77692 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 18 Dec 2009 02:11:24 +0100 Subject: [PATCH] tracehooks: check PT_PTRACED before reporting the single-step No functional changes, preparation for utrace-ptrace. tracehook_report_syscall_exit() and tracehook_signal_handler() assume that only ptrace can set TIF_SINGLESTEP. Currently this is true but we are going to change this, the stepping logic will be moved into utrace layer. Change this code to check PT_PTRACED, ptrace-utrace doesn't set it. Signed-off-by: Roland McGrath Signed-off-by: Oleg Nesterov --- include/linux/tracehook.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 6f3c61c..c78b2f4 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h @@ -134,7 +134,7 @@ static inline __must_check int tracehook_report_syscall_entry( */ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step) { - if (step) { + if (step && (task_ptrace(current) & PT_PTRACED)) { siginfo_t info; user_single_step_siginfo(current, regs, &info); force_sig_info(SIGTRAP, &info, current); @@ -386,7 +386,7 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info, const struct k_sigaction *ka, struct pt_regs *regs, int stepping) { - if (stepping) + if (stepping && (task_ptrace(current) & PT_PTRACED)) ptrace_notify(SIGTRAP); } -- 1.6.2.5