From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: [PATCH RFC] nsproxy: strengthen the comment above copy_namespaces Date: Fri, 30 Apr 2010 13:36:38 -0500 Message-ID: <20100430183638.GA29240@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Linux Containers Cc: "Eric W. Biederman" List-Id: containers.vger.kernel.org copy_namespaces() cannot be used on a live task. There are two reasons - it can be used to assign another task's nsproxy, which is not legal (for a live task). And, it does not use rcu_assign_pointer, so even when we're being extra-clever it is unsafe. Signed-off-by: Serge Hallyn --- kernel/nsproxy.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index f74e6c0..67d8f2b 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -115,6 +115,9 @@ out_ns: /* * called from clone. This now handles copy for nsproxy and all * namespaces therein. + * Note this should only be used in fork. Specifically, tsk should + * not yet be a live task. See the the unshare code for how to handle + * that. */ int copy_namespaces(unsigned long flags, struct task_struct *tsk) { -- 1.6.3.3