Commit edaba2c5 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

ptrace: revert "ptrace_detach: the wrong wakeup breaks the ERESTARTxxx logic"

Commit 95a3540d ("ptrace_detach: the wrong
wakeup breaks the ERESTARTxxx logic") removed the "extra"
wake_up_process() from ptrace_detach(), but as Jan pointed out this breaks
the compatibility.

I believe the changelog is right and this wake_up() is wrong in many
ways, but GDB assumes that ptrace(PTRACE_DETACH, child, 0, 0) always
wakes up the tracee.

Despite the fact this breaks SIGNAL_STOP_STOPPED/group_stop_count logic,
and despite the fact this wake_up_process() can break another
assumption: PTRACE_DETACH with SIGSTOP should leave the tracee in
TASK_STOPPED case.  Because the untraced child can dequeue SIGSTOP and
call do_signal_stop() before ptrace_detach() calls wake_up_process().

Revert this change for now.  We need some fixes even if we we want to keep
the current behaviour, but these fixes are not for 2.6.30.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 08f67461
...@@ -304,6 +304,8 @@ int ptrace_detach(struct task_struct *child, unsigned int data) ...@@ -304,6 +304,8 @@ int ptrace_detach(struct task_struct *child, unsigned int data)
if (child->ptrace) { if (child->ptrace) {
child->exit_code = data; child->exit_code = data;
dead = __ptrace_detach(current, child); dead = __ptrace_detach(current, child);
if (!child->exit_state)
wake_up_process(child);
} }
write_unlock_irq(&tasklist_lock); write_unlock_irq(&tasklist_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment