Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1206936
| From | ebiederm@xmission.com (Eric W. Biederman) |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm |
| Date | 2015-08-13 18:10 +0200 |
| Message-ID | <pX3eP-8ec-25@gated-at.bofh.it> (permalink) |
| References | (6 earlier) <pWt1E-5Oa-3@gated-at.bofh.it> <pWtbk-5Z7-21@gated-at.bofh.it> <pWItI-3b8-15@gated-at.bofh.it> <pWKvw-6id-19@gated-at.bofh.it> <pX0gX-3L0-35@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Oleg Nesterov <oleg@redhat.com> writes:
> On 08/12, Eric W. Biederman wrote:
>>
>> + if (unshare_flags & (CLONE_SIGHAND | CLONE_VM)) {
>> + if (atomic_read(¤t->sighand->count) > 1)
>> + return -EINVAL;
>> + }
>
> I am still not sure we want this... please the the previous email.
Reading your other email I did not see why you thought this check was
unnecessary.
> But perhaps I missed something.
In short:
clone(VM) --> mm_users > 1 && sighand_struct->count == 1
followed by:
unshare(SIGHAND)
the unshare should succeed.
Meanwhile:
clone(VM|SIGHAND) --> mm_users > 1 && sighand_struct->count > 1
followed by:
unshare(SIGHAND)
the unshare should fail.
I actually tested both of these cases and my patch works properly.
Not that I expect that there is anyone actually calling unshare(SIGHAND)
but unless we figure out how to remove the code, the code should
function correctly. If for no other reason than to not confuse people
reading and maintaining the code.
Further I have audited the callers and we don't have anyone playing
games with sighand->count. There is an implementation of unsharing the
sighand_struct in dethread in fs/exec.c that relies on this.
Other possible tests such as current_is_single_threaded() and
thread_group_empty() fail at the wrong times to be used.
So I think it is clear that testing for a private sighand_struct is
necessaring and testing sighand->count is a perfectly fine test.
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] user_ns: use correct check for single-threadedness Oleg Nesterov <oleg@redhat.com> - 2015-08-05 19:30 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness ebiederm@xmission.com (Eric W. Biederman) - 2015-08-05 20:10 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness ebiederm@xmission.com (Eric W. Biederman) - 2015-08-05 21:00 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness Oleg Nesterov <oleg@redhat.com> - 2015-08-06 16:10 +0200
[PATCH 0/2] userns: Creation logic fixes ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 03:30 +0200
[PATCH 2/2] userns,pidns: Force thread group sharing, not signal handler sharing ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 03:40 +0200
Re: [PATCH 2/2] userns,pidns: Force thread group sharing, not signal handler sharing Oleg Nesterov <oleg@redhat.com> - 2015-08-12 19:30 +0200
[PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 03:40 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-12 20:00 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 20:50 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-13 15:00 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-13 17:50 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-13 18:20 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-13 18:40 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-13 19:00 +0200
Re: [PATCH 1/2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-14 20:10 +0200
[PATCH v2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 22:10 +0200
Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-13 15:00 +0200
Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-13 18:10 +0200
Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm Oleg Nesterov <oleg@redhat.com> - 2015-08-13 18:40 +0200
Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm ebiederm@xmission.com (Eric W. Biederman) - 2015-08-13 18:50 +0200
Re: [PATCH 0/2] userns: Creation logic fixes Kees Cook <keescook@chromium.org> - 2015-08-12 08:30 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 03:30 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness Oleg Nesterov <oleg@redhat.com> - 2015-08-12 16:50 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness ebiederm@xmission.com (Eric W. Biederman) - 2015-08-12 17:20 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness Oleg Nesterov <oleg@redhat.com> - 2015-08-06 17:20 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness ebiederm@xmission.com (Eric W. Biederman) - 2015-08-06 23:30 +0200
Re: [PATCH] user_ns: use correct check for single-threadedness Oleg Nesterov <oleg@redhat.com> - 2015-08-07 04:50 +0200
csiph-web