]> git.karo-electronics.de Git - linux-beck.git/blobdiff - kernel/fork.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
[linux-beck.git] / kernel / fork.c
index e05cff2429b5d74fdff15d1efec9244568f82a53..c535f33bbb9c9ad108c394618474bbbce1f64f86 100644 (file)
@@ -1166,6 +1166,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
                                current->signal->flags & SIGNAL_UNKILLABLE)
                return ERR_PTR(-EINVAL);
 
+       /*
+        * If the new process will be in a different pid namespace
+        * don't allow the creation of threads.
+        */
+       if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
+           (task_active_pid_ns(current) != current->nsproxy->pid_ns))
+               return ERR_PTR(-EINVAL);
+
        retval = security_task_create(clone_flags);
        if (retval)
                goto fork_out;