Commit:     6405f7f4675884b671bee66678e1c2859bdb0e56
Parent:     c0c0b649d67aa775aa9851de61aade17504be70c
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:19:00 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:26 2008 -0800

    ptrace_stop: fix the race with ptrace detach+attach
    If the tracer went away (may_ptrace_stop() failed), ptrace_stop() drops
    tasklist and then changes the ->state from TASK_TRACED to TASK_RUNNING.
    This can fool another tracer which attaches to us in between.  Change the
    ->state under tasklist_lock to ensure that ptrace_check_attach() can't 
    succeed.  Also, remove the unnecessary mb().
    Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
    Acked-by: Roland McGrath <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 kernel/signal.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 6d6d1ab..678bffa 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1638,11 +1638,11 @@ static void ptrace_stop(int exit_code, int nostop_code, 
siginfo_t *info)
        } else {
                 * By the time we got the lock, our tracer went away.
-                * Don't stop here.
+                * Don't drop the lock yet, another tracer may come.
-               read_unlock(&tasklist_lock);
-               set_current_state(TASK_RUNNING);
+               __set_current_state(TASK_RUNNING);
                current->exit_code = nostop_code;
+               read_unlock(&tasklist_lock);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to