The patch titled ipc: sysvsem: force unshare(CLONE_SYSVSEM) when CLONE_NEWIPC has been removed from the -mm tree. Its filename was ipc-sysvsem-force-unshareclone_sysvsem-when-clone_newipc.patch This patch was dropped because it was merged into mainline or a subsystem tree The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ipc: sysvsem: force unshare(CLONE_SYSVSEM) when CLONE_NEWIPC From: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> sys_unshare(CLONE_NEWIPC) doesn't handle the undo lists properly, this can cause a kernel memory corruption. CLONE_NEWIPC must detach from the existing undo lists. Fix, part 2: perform an implicit CLONE_SYSVSEM in CLONE_NEWIPC. CLONE_NEWIPC creates a new IPC namespace, the task cannot access the existing semaphore arrays after the unshare syscall. Thus the task can/must detach from the existing undo list entries, too. This fixes the kernel corruption, because it makes it impossible that undo records from two different namespaces are in sysvsem.undo_list. Signed-off-by: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx> Acked-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Michael Kerrisk <mtk.manpages@xxxxxxxxxxxxxx> Cc: Pierre Peiffer <peifferp@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/fork.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff -puN kernel/fork.c~ipc-sysvsem-force-unshareclone_sysvsem-when-clone_newipc kernel/fork.c --- a/kernel/fork.c~ipc-sysvsem-force-unshareclone_sysvsem-when-clone_newipc +++ a/kernel/fork.c @@ -1696,7 +1696,12 @@ asmlinkage long sys_unshare(unsigned lon 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; _ Patches currently in -mm which might be from manfred@xxxxxxxxxxxxxxxx are origin.patch idr-fix-idr_remove.patch idr-introduce-the-ridr-structure.patch idr-introduce-ridr_pre_get.patch idr-introduce-ridr_init.patch idr-introduce-ridr_get_new_above.patch idr-introduce-ridr_get_new.patch idr-introduce-ridr_find.patch idr-introduce-ridr_remove.patch ipc-integrate-the-ridr-code-into-ipc-code.patch ipc-get-rid-of-ipc_lock_down.patch mm-debug-dump-pageframes-on-bad_page.patch slab-leaks3-default-y.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html