ptrace_wake_up() clears tracee->exit_code, this is racy and no longer needed.
This was needed previously when ->exit_code was checked by callbacks. Now ->exit_code is only used by do_wait(), and we have no reasons to clear it. If the tracee exits or stops again ->exit_code will be correctly updated anyway, until then it has no effect. Also, update the comment. --- kernel/ptrace.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- PU/kernel/ptrace.c~91_CLEANUP_FIX_WAKEUP 2009-10-14 13:18:45.000000000 +0200 +++ PU/kernel/ptrace.c 2009-10-15 20:09:10.000000000 +0200 @@ -944,24 +944,24 @@ void ptrace_notify_stop(struct task_stru utrace_engine_put(engine); } -static void ptrace_wake_up( struct task_struct *tracee, +static void ptrace_wake_up(struct task_struct *tracee, struct utrace_engine *engine, enum utrace_resume_action action, bool force_wakeup) { if (force_wakeup) { unsigned long flags; - - /* preserve the compatibility bug */ - if (!lock_task_sighand(tracee, &flags)) - return; - tracee->signal->flags &= ~SIGNAL_STOP_STOPPED; - unlock_task_sighand(tracee, &flags); + /* + * Preserve the compatibility bug. Historically ptrace + * wakes up the tracee even if it should not. Clear + * SIGNAL_STOP_STOPPED for utrace_wakeup(). + */ + if (lock_task_sighand(tracee, &flags)) { + tracee->signal->flags &= ~SIGNAL_STOP_STOPPED; + unlock_task_sighand(tracee, &flags); + } } - // XXX: FIXME!!! racy. - tracee->exit_code = 0; - ptrace_context(engine)->stop_code = 0; utrace_control(tracee, engine, action); }