linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Andrei Vagin <avagin@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
	 Dmitry Safonov <0x7f454c46@gmail.com>,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 Eric Biederman <ebiederm@xmission.com>,
	 Kees Cook <keescook@chromium.org>,
	 Alexey Izbyshev <izbyshev@ispras.ru>
Subject: Re: Potentially undesirable interactions between vfork() and time namespaces
Date: Thu, 01 Sep 2022 06:21:51 +0200	[thread overview]
Message-ID: <87tu5ru3kw.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <YxAq2jYvGG8QOypu@gmail.com> (Andrei Vagin's message of "Wed, 31 Aug 2022 20:45:30 -0700")

* Andrei Vagin:

> On Tue, Aug 30, 2022 at 6:18 PM Andrei Vagin <avagin@gmail.com> wrote:
>>On Tue, Aug 30, 2022 at 10:49:43PM +0300, Alexey Izbyshev wrote:
> <snip>
>>> @@ -1030,6 +1033,10 @@ static int exec_mmap(struct mm_struct *mm)
>>>         tsk->mm->vmacache_seqnum = 0;
>>>         vmacache_flush(tsk);
>>>         task_unlock(tsk);
>>> +
>>> +       if (vfork)
>>> +               timens_on_fork(tsk->nsproxy, tsk);
>>> +
>>> 
>>> Similarly, even after a normal vfork(), time namespace switch could be
>>> silently skipped if the parent dies before "tsk->vfork_done" is read. Again,
>>> I don't know whether anybody cares, but this behavior seems non-obvious and
>>> probably unintended to me.
>> This is the more interesting case. I will try to find out how we can
>> handle it properly.
>
> It might not be a good idea to use vfork_done in this case. Let's
> think about what we have and what we want to change. We don't want to
> allow switching timens if a process mm is used by someone else. But we
> forgot to handle execve that creates a new mm, and we can't change this
> behavior right now because it can affect current users. Right?
>
> So maybe the best choice, in this case, is to change behavior by adding
> a new control that enables it. The first interface that comes to my mind
> is to introduce a new ioctl for a namespace file descriptor. Here is a
> draft patch below that should help to understand what I mean.

Doesn't this bring back the old posix_spawn (vfork) failure?

Thanks,
Florian



  reply	other threads:[~2022-09-01  4:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 19:49 Alexey Izbyshev
2022-08-31  1:18 ` Andrei Vagin
2022-09-01  3:45   ` Andrei Vagin
2022-09-01  4:21     ` Florian Weimer [this message]
2022-09-01 15:49     ` Alexey Izbyshev
2022-09-01 18:11     ` Eric W. Biederman
2022-09-02 16:14       ` Andrei Vagin
2022-09-02 16:39         ` Alexey Izbyshev
2022-09-02 17:20           ` Andrei Vagin
2022-09-02 17:01       ` Alexey Izbyshev
2022-09-02 17:28         ` Andrei Vagin
2022-09-06 22:16         ` Eric W. Biederman
2022-09-07  5:33           ` Alexey Izbyshev
2022-09-07 17:15             ` Andrei Vagin
2022-09-08  8:10               ` Christian Brauner
2022-09-08 22:13                 ` Eric W. Biederman
2022-09-09  7:51                   ` Christian Brauner
2022-09-11 15:12                     ` Kees Cook
2022-09-11 22:51                       ` Andrei Vagin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tu5ru3kw.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=0x7f454c46@gmail.com \
    --cc=avagin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=izbyshev@ispras.ru \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox