arm: arch_timer: divorce from local_timer api
[firefly-linux-kernel-4.4.55.git] / kernel / fork.c
index a31b823b3c2d6d4e6254128f00e36c6c1b048c37..65ca6d27f24e1065013a428f12f33935b1b18490 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;