[PATCH 46] pretens ptrace_detach(sig) works

Oleg Nesterov oleg at redhat.com
Thu Sep 17 19:08:19 UTC 2009


The current "implementation" of ptrace_report_signa() is almost a joke,
but still I was surprized the fatal signals do not work under strace.

I spent a lot of time before I realized this doesn't work from the very
beginning: I didn't know that when strace notices the fatal signal, it
doesn't resume the tracee but simply does ptrace(DETACH, sig).

Change ptrace_detach() to send the signal if data != 0. This is not
correct of course, but a bit better than nothing.

Another reason for this change: from now ptrace doesn't abuse->exit_code,
we only set it for do_wait() in do_ptrace_notify_stop(), and clear it in
ptrace_resume().

---

 kernel/ptrace.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- PU/kernel/ptrace.c~46_DETACH_SEND_SIG	2009-09-17 18:41:47.000000000 +0200
+++ PU/kernel/ptrace.c	2009-09-17 19:33:34.000000000 +0200
@@ -705,8 +705,9 @@ static void ptrace_do_detach(struct task
 	detach = tracee->ptrace != 0;
 	release = false;
 	if (likely(detach)) {
-		if (valid_signal(data))
-			tracee->exit_code = data;
+		// XXX: temporary hack
+		if (data && valid_signal(data))
+			send_sig(data, tracee, 1);
 		release = __ptrace_detach(current, tracee);
 	}
 	write_unlock_irq(&tasklist_lock);




More information about the utrace-devel mailing list