diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-08-10 17:35:07 -0500 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-09-30 11:00:00 +0200 |
commit | 40608bef40d58dc915cdb94274f76ca029372bec (patch) | |
tree | 9eb1052fb6990443d8227842488c47f9ad848c74 /drivers/net | |
parent | 8f5ea57d547accab3226e35bdabdf68c7b6f425b (diff) | |
download | lwn-40608bef40d58dc915cdb94274f76ca029372bec.tar.gz lwn-40608bef40d58dc915cdb94274f76ca029372bec.zip |
unshare: Unsharing a thread does not require unsharing a vm
commit 12c641ab8270f787dfcce08b5f20ce8b65008096 upstream.
In the logic in the initial commit of unshare made creating a new
thread group for a process, contingent upon creating a new memory
address space for that process. That is wrong. Two separate
processes in different thread groups can share a memory address space
and clone allows creation of such proceses.
This is significant because it was observed that mm_users > 1 does not
mean that a process is multi-threaded, as reading /proc/PID/maps
temporarily increments mm_users, which allows other processes to
(accidentally) interfere with unshare() calls.
Correct the check in check_unshare_flags() to test for
!thread_group_empty() for CLONE_THREAD, CLONE_SIGHAND, and CLONE_VM.
For sighand->count > 1 for CLONE_SIGHAND and CLONE_VM.
For !current_is_single_threaded instead of mm_users > 1 for CLONE_VM.
By using the correct checks in unshare this removes the possibility of
an accidental denial of service attack.
Additionally using the correct checks in unshare ensures that only an
explicit unshare(CLONE_VM) can possibly trigger the slow path of
current_is_single_threaded(). As an explict unshare(CLONE_VM) is
pointless it is not expected there are many applications that make
that call.
Fixes: b2e0d98705e60e45bbb3c0032c48824ad7ae0704 userns: Implement unshare of the user namespace
Reported-by: Ricky Zhou <rickyz@chromium.org>
Reported-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/net')
0 files changed, 0 insertions, 0 deletions