Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH RFC] nsproxy: strengthen the comment above copy_namespaces
Date: Fri, 30 Apr 2010 13:36:38 -0500	[thread overview]
Message-ID: <20100430183638.GA29240@us.ibm.com> (raw)

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 <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 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

             reply	other threads:[~2010-04-30 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30 18:36 Serge E. Hallyn [this message]
     [not found] ` <20100430183638.GA29240-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-06-15  2:54   ` [PATCH RFC] nsproxy: strengthen the comment above copy_namespaces Oren Laadan
     [not found]     ` <4C16EB55.1090101-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-06-15 20:37       ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100430183638.GA29240@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox