Change ptrace_report_signal() to handle UTRACE_SIGNAL_HANDLER case correctly: just push the new stop event if the tracer wants stepping.
We do not set context->siginfo = info, this would be wrong because we do not report a signal. I wonder how the tracer can distinguish this case from the real SIGTRAP. >From now, compared to the vanilla kernel, we fail 2 tests: attach-wait-on-stopped - this is correct, it should fail, ptrace_detach() doesn't do the unconditional wakeup. attach-into-signal - this is understandable. This test assumes that after ptrace(DETACH, sig) the next attach should not see this signal. I wonder if we should try hard to keep this behaviour, this doesn't look very useful to me. This is sad, because this just means we don't have enough tests... --- kernel/ptrace.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- PU/kernel/ptrace.c~52_SIGNAL_HANDLER 2009-09-23 00:50:28.000000000 +0200 +++ PU/kernel/ptrace.c 2009-09-23 01:46:48.000000000 +0200 @@ -362,7 +362,16 @@ static u32 ptrace_report_signal(u32 acti switch (utrace_signal_action(action)) { case UTRACE_SIGNAL_HANDLER: - WARN_ON(1); + if (resume != UTRACE_RESUME) { + if (WARN_ON(context->siginfo)) + context->siginfo = NULL; + + ev = ev_push(context); + ev->ev_code = SIGTRAP; + + return UTRACE_STOP | UTRACE_SIGNAL_IGN; + } + case UTRACE_SIGNAL_REPORT: if (!context->siginfo) return resume | UTRACE_SIGNAL_IGN;