The patch titled Subject: userns,pidns: force thread group sharing, not signal handler sharing has been added to the -mm tree. Its filename is usernspidns-force-thread-group-sharing-not-signal-handler-sharing.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/usernspidns-force-thread-group-sharing-not-signal-handler-sharing.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/usernspidns-force-thread-group-sharing-not-signal-handler-sharing.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Subject: userns,pidns: force thread group sharing, not signal handler sharing The code that places signals in signal queues computes the uids, gids, and pids at the time the signals are enqueued. Which means that tasks that share signal queues must be in the same pid and user namespaces. Sharing signal handlers is fine, but bizarre. So make the code in fork and userns_install clearer by only testing for what is functionally necessary. Also update the comment in unshare about unsharing a user namespace to be a little more explicit and make a little more sense. Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Ricky Zhou <rickyz@xxxxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> Cc: Julien Tinnes <jln@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/fork.c | 8 ++++---- kernel/user_namespace.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff -puN kernel/fork.c~usernspidns-force-thread-group-sharing-not-signal-handler-sharing kernel/fork.c --- a/kernel/fork.c~usernspidns-force-thread-group-sharing-not-signal-handler-sharing +++ a/kernel/fork.c @@ -1280,10 +1280,9 @@ static struct task_struct *copy_process( /* * If the new process will be in a different pid or user namespace - * do not allow it to share a thread group or signal handlers or - * parent with the forking task. + * do not allow it to share a thread group with the forking task. */ - if (clone_flags & CLONE_SIGHAND) { + if (clone_flags & CLONE_THREAD) { if ((clone_flags & (CLONE_NEWUSER | CLONE_NEWPID)) || (task_active_pid_ns(current) != current->nsproxy->pid_ns_for_children)) @@ -1951,7 +1950,8 @@ SYSCALL_DEFINE1(unshare, unsigned long, int err; /* - * If unsharing a user namespace must also unshare the thread. + * If unsharing a user namespace must also unshare the thread group + * and unshare the filesystem root and working directories. */ if (unshare_flags & CLONE_NEWUSER) unshare_flags |= CLONE_THREAD | CLONE_FS; diff -puN kernel/user_namespace.c~usernspidns-force-thread-group-sharing-not-signal-handler-sharing kernel/user_namespace.c --- a/kernel/user_namespace.c~usernspidns-force-thread-group-sharing-not-signal-handler-sharing +++ a/kernel/user_namespace.c @@ -977,8 +977,8 @@ static int userns_install(struct nsproxy if (user_ns == current_user_ns()) return -EINVAL; - /* Threaded processes may not enter a different user namespace */ - if (atomic_read(¤t->mm->mm_users) > 1) + /* Tasks that share a thread group must share a user namespace */ + if (!thread_group_empty(current)) return -EINVAL; if (current->fs->users != 1) _ Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are proc-change-proc_subdir_lock-to-a-rwlock.patch kexec-split-kexec_file-syscall-code-to-kexec_filec.patch kexec-split-kexec_load-syscall-from-kexec-core-code.patch kdump-vmcoreinfo-report-actual-value-of-phys_base.patch sysctl-fix-int-unsigned-long-assignments-in-int_min-case.patch unshare-unsharing-a-thread-does-not-require-unsharing-a-vm.patch usernspidns-force-thread-group-sharing-not-signal-handler-sharing.patch linux-next.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