[PATCH 1/2] ptrace: wait_task_zombie: do not account tracedsub-threads
From: Oleg Nesterov
Date: Mon Jun 15 2009 - 17:31:38 EST
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@xxxxxxxxxx>
--- 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/