Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1206953
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] unshare: Unsharing a thread does not require unsharing a vm |
| Date | 2015-08-13 18:40 +0200 |
| Message-ID | <pX3HP-kx-11@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <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> <pX3eP-8ec-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 08/13, Eric W. Biederman wrote:
>
> 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.
Yes, yes, yes.
But once again, I meant we can remove this sighand->count check
if unshare(SIGHAND) checks current_is_single_threaded(). That is
why I suggested to do
if (unshare_flags & CLONE_SIGHAND)
unshare_flags |= CLONE_VM;
in sys_unshare(), or change check_unshare_flags() to check
"unshare_flags & (CLONE_VM | CLONE_SIGHAND)" before
current_is_single_threaded().
Damn. And this discussion makes me think that another cleanup makes
sense too. Can't we move all these unshare_flags manipulations into
check_unshare_flags? So that sys_unshare() will only do
err = check_unshare_flags(&unshare_flags);
and the reader of this code won't need to read 2 functions to understand
whats going on.
Oleg.
--
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