X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=kernel%2Fnsproxy.c;h=adc785146a1cb81d6f7b3d676877921f10bb59e7;hb=c907310fb0a5dd69a7fe11c08368abb0d34a35cb;hp=f5d332cf8c631704b1ee440c35317644e4f6eff9;hpb=c58310bf4933986513020fa90b4190c7492995ae;p=cascardo%2Flinux.git diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index f5d332cf8c63..adc785146a1c 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -139,6 +139,18 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk) goto out; } + /* + * CLONE_NEWIPC must detach from the undolist: after switching + * to a new ipc namespace, the semaphore arrays from the old + * namespace are unreachable. In clone parlance, CLONE_SYSVSEM + * means share undolist with parent, so we must forbid using + * it along with CLONE_NEWIPC. + */ + if ((flags & CLONE_NEWIPC) && (flags & CLONE_SYSVSEM)) { + err = -EINVAL; + goto out; + } + new_ns = create_new_namespaces(flags, tsk, tsk->fs); if (IS_ERR(new_ns)) { err = PTR_ERR(new_ns);