All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ptrace: wait_task_zombie: do not account traced sub-threads
@ 2009-06-15 21:26 Oleg Nesterov
  2009-06-16  0:45 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2009-06-15 21:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Zijlstra, Roland McGrath, Stanislaw Gruszka,
	Vitaly Mayatskikh, linux-kernel

The bug is ancient, the fix doesn't depend on other changes in -mm.

If we trace the sub-thread of our natural child and this sub-thread exits,
we update parent->signal->cxxx fields. But we should not do this until the
whole thread-group exits, otherwise we account this thread (and all other
live threads) twice.

Add the task_detached() check. No need to check thread_group_empty(),
wait_consider_task()->delay_group_leader() already did this.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- PTRACE/kernel/exit.c~1_WAIT_REPARENTED	2009-06-15 21:04:49.000000000 +0200
+++ PTRACE/kernel/exit.c	2009-06-15 22:26:02.000000000 +0200
@@ -1189,7 +1189,7 @@ static int wait_task_zombie(struct wait_
 
 	traced = ptrace_reparented(p);
 
-	if (likely(!traced)) {
+	if (likely(!traced) && likely(!task_detached(p))) {
 		struct signal_struct *psig;
 		struct signal_struct *sig;
 		struct task_cputime cputime;


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

end of thread, other threads:[~2009-06-18 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15 21:26 [PATCH 1/2] ptrace: wait_task_zombie: do not account traced sub-threads Oleg Nesterov
2009-06-16  0:45 ` Roland McGrath
2009-06-17 19:48   ` [rfc] ptrace: wait_task_zombie: fix the racy EXIT_ZOMBIE setting Oleg Nesterov
2009-06-18 18:47   ` [PATCH] ptrace-wait_task_zombie-do-not-account-traced-sub-threads-fix Oleg Nesterov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.