X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Fnsproxy.c;h=adc785146a1cb81d6f7b3d676877921f10bb59e7;hb=424de91dd6163808729d7082de55c319e1096bee;hp=79f871bc0ef40026e111df575622cbc6b11031c3;hpb=37e58df30063e229ee5157f9d1c1fa1d749917c2;p=linux-2.6 diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 79f871bc0e..adc785146a 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -21,6 +21,7 @@ #include #include #include +#include static struct kmem_cache *nsproxy_cachep; @@ -138,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);