Skip to contentSkip to conversation

nsproxy: strengthen the comment above copy_namespaces

RFC PATCH In review Serge E. Hallyn 3 participants 3 messages Apr 30, 2010 – Jun 15, 2010 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 nsproxy: strengthen the comment above copy_namespaces

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.

---
 kernel/nsproxy.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/nsproxy.c +3 -0
index f74e6c0..67d8f2b 100644
@@ -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)
 {
Signature · 1 line
1.6.3.3
#2 lore raw
In reply to a message not in the archive

Serge -

Is this intended for linux-cr ?
Sounds like it should go (or already?) upstream.

Oren.

Quoted 25 lines · Serge E. Hallyn

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.

---
 kernel/nsproxy.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/nsproxy.c +3 -0
index f74e6c0..67d8f2b 100644
@@ -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)
 {
#4 lore raw
In reply to a message not in the archive
Quoted 4 lines · Oren Laadan

Serge -

Is this intended for linux-cr ?
Sounds like it should go (or already?) upstream.

It was intended for upstream, bit i was fishing for acks/feedback before pushing further.

Quoted 32 lines

Oren.

Quoted 16 lines · Serge E. Hallyn

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.

---
 kernel/nsproxy.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/nsproxy.c +0 -0
index f74e6c0..67d8f2b 100644

kernel/nsproxy.c out_ns: · line 123

Quoted 9 lines
kernel/nsproxy.c +3 -0
@@ -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)
 {

_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers