pidns: deny CLONE_PARENT|CLONE_NEWPID combination
authorSukadev Bhattiprolu <[email protected]>
Wed, 23 Sep 2009 22:57:22 +0000 (15:57 -0700)
committerLinus Torvalds <[email protected]>
Thu, 24 Sep 2009 14:21:04 +0000 (07:21 -0700)
CLONE_PARENT was used to implement an older threading model.  For
consistency with the CLONE_THREAD check in copy_pid_ns(), disable
CLONE_PARENT with CLONE_NEWPID, at least until the required semantics of
pid namespaces are clear.

Signed-off-by: Sukadev Bhattiprolu <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Acked-by: Serge Hallyn <[email protected]>
Cc: Oren Laadan <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/pid_namespace.c

index 821722ae58a732760f62a00912554e3779fc2d04..86b3796b0436726e5b0208021cc990bfdc7044e2 100644 (file)
@@ -118,7 +118,7 @@ struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old
 {
        if (!(flags & CLONE_NEWPID))
                return get_pid_ns(old_ns);
-       if (flags & CLONE_THREAD)
+       if (flags & (CLONE_THREAD|CLONE_PARENT))
                return ERR_PTR(-EINVAL);
        return create_pid_namespace(old_ns);
 }