[PATCH 2/7] tracehook_signal_handler: check PT_PTRACED

Oleg Nesterov oleg at redhat.com
Mon Oct 26 03:28:44 UTC 2009


No functional changes, preparation for utrace-ptrace.

tracehook_signal_handler() is the only caller of ptrace_notify() which
doesn't check the task is ptraced, it assumes that only ptrace can set
TIF_SINGLESTEP.

Currently this is true but we are going to change this, check PT_PTRACED.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---

 include/linux/tracehook.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- V1/include/linux/tracehook.h~2_SIGNAL_HANDLER_CK_PTRACE	2009-10-25 23:34:16.000000000 +0100
+++ V1/include/linux/tracehook.h	2009-10-26 00:25:53.000000000 +0100
@@ -379,7 +379,7 @@ static inline void tracehook_signal_hand
 					    const struct k_sigaction *ka,
 					    struct pt_regs *regs, int stepping)
 {
-	if (stepping)
+	if (stepping && (task_ptrace(current) & PT_PTRACED))
 		ptrace_notify(SIGTRAP);
 }
 




More information about the utrace-devel mailing list