LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] namespaces: fix race at task exit
@ 2007-01-25 15:05 Serge E. Hallyn
  2007-01-25 15:20 ` Cedric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Serge E. Hallyn @ 2007-01-25 15:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Eric W. Biederman, Cedric Le Goater, Oleg Nesterov,
	Daniel Hokka Zakrisson, herbert, akpm, trond.myklebust,
	Linux Containers

In do_exit(), the exit_task_namespaces() was placed after
exit_notify() because exit_notify ends up using the pid
namespace both to access the reaper, and for detaching the
pid.  However, this placement allows an nfs server to reap
the task before exit_task_namespaces() completes.

This patch moves the exit_task_namespaces() into release_task,
below release_thread() which puts the pids(), and just above
the call_rcu(delayed_put_task_struct).  I believe this should
solve both problems.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>

---

 kernel/exit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

765277a4170d7bbd1c4613de661ec6ac64d5580a
diff --git a/kernel/exit.c b/kernel/exit.c
index 3540172..ab9ae30 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -174,6 +174,7 @@ repeat:
 	write_unlock_irq(&tasklist_lock);
 	proc_flush_task(p);
 	release_thread(p);
+	exit_task_namespaces(p);
 	call_rcu(&p->rcu, delayed_put_task_struct);
 
 	p = leader;
@@ -939,7 +940,6 @@ fastcall NORET_TYPE void do_exit(long co
 	tsk->exit_code = code;
 	proc_exit_connector(tsk);
 	exit_notify(tsk);
-	exit_task_namespaces(tsk);
 #ifdef CONFIG_NUMA
 	mpol_free(tsk->mempolicy);
 	tsk->mempolicy = NULL;
-- 
1.1.6

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

end of thread, other threads:[~2007-01-25 20:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-25 15:05 [PATCH] namespaces: fix race at task exit Serge E. Hallyn
2007-01-25 15:20 ` Cedric Le Goater
2007-01-25 16:29 ` Eric W. Biederman
2007-01-25 17:35   ` Serge E. Hallyn
2007-01-25 20:36     ` Serge E. Hallyn
2007-01-25 16:39 ` Oleg Nesterov
2007-01-25 17:36   ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).