reparent_thread: fix the "is it traced" check

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, April 2, 2009 - 10:02 pm

Gitweb:     http://git.kernel.org/linus/b1442b055c154699a6a2c436f3352f71b6beede3
Commit:     b1442b055c154699a6a2c436f3352f71b6beede3
Parent:     0a967a044a777e8b9c739120927114ddc0094298
Author:     Oleg Nesterov <oleg@redhat.com>
AuthorDate: Thu Apr 2 16:58:16 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Apr 2 19:04:59 2009 -0700

    reparent_thread: fix the "is it traced" check
    
    reparent_thread() uses ptrace_reparented() to check whether this thread is
    ptraced, in that case we should not notify the new parent.
    
    But ptrace_reparented() is not exactly correct when the reparented thread
    is traced by /sbin/init, because forget_original_parent() has already
    changed ->real_parent.
    
    Currently, the only problem is the false notification.  But with the next
    patch the kernel crash in this (yes, pathological) case.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 kernel/exit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 405e687..5be0a40 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -832,7 +832,7 @@ static void reparent_thread(struct task_struct *p, struct task_struct *father)
 	/* If we'd notified the old parent about this child's death,
 	 * also notify the new parent.
 	 */
-	if (!ptrace_reparented(p) &&
+	if (!p->ptrace &&
 	    p->exit_state == EXIT_ZOMBIE && thread_group_empty(p))
 		do_notify_parent(p, p->exit_signal);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
reparent_thread: fix the "is it traced" check, Linux Kernel Mailing ..., (Thu Apr 2, 10:02 pm)