mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/4] reparent_thread: fix the "is it traced" check
@ 2009-01-29  8:05 Oleg Nesterov
  2009-02-05  2:16 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2009-01-29  8:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Eric W. Biederman, Roland McGrath, linux-kernel

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>

--- 6.29-rc3/kernel/exit.c~6_FIX_PTRACE_CHECK	2009-01-29 06:21:51.000000000 +0100
+++ 6.29-rc3/kernel/exit.c	2009-01-29 06:57:09.000000000 +0100
@@ -826,7 +826,7 @@ static void reparent_thread(struct task_
 	/* 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);
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/4] reparent_thread: fix the "is it traced" check
  2009-01-29  8:05 [PATCH 2/4] reparent_thread: fix the "is it traced" check Oleg Nesterov
@ 2009-02-05  2:16 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2009-02-05  2:16 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Eric W. Biederman, linux-kernel

> reparent_thread() uses ptrace_reparented() to check whether this thread
> is ptraced, in that case we should not notify the new parent.

I think at some point in the past, ptracedness could sometimes transfer to
the new parent, so this made sense then (before it had that name).

> 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.

Heh.  Ok.  I think the !p->ptrace check is fine.

Acked-by: Roland McGrath <roland@redhat.com>


Thanks,
Roland

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-05  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29  8:05 [PATCH 2/4] reparent_thread: fix the "is it traced" check Oleg Nesterov
2009-02-05  2:16 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®