diff options
-rw-r--r-- | kernel/fork.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 01666979bea..de5c16c6b6e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1696,7 +1696,12 @@ asmlinkage long sys_unshare(unsigned long unshare_flags) CLONE_NEWNET)) goto bad_unshare_out; - if (unshare_flags & CLONE_SYSVSEM) + /* + * CLONE_NEWIPC must also detach from the undolist: after switching + * to a new ipc namespace, the semaphore arrays from the old + * namespace are unreachable. + */ + if (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM)) do_sysvsem = 1; if ((err = unshare_thread(unshare_flags))) goto bad_unshare_out; |