linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	akpm@linux-foundation.org, regressions@leemhuis.info,
	bagasdotme@gmail.com, jacobly.alt@gmail.com, willy@infradead.org,
	liam.howlett@oracle.com, david@redhat.com, peterx@redhat.com,
	ldufour@linux.ibm.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
	regressions@lists.linux.dev, "Jiri Slaby" <jirislaby@kernel.org>,
	"Holger Hoffstätte" <holger@applied-asynchrony.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 3/3] fork: lock VMAs of the parent process when forking
Date: Sat, 5 Aug 2023 03:16:59 +0200	[thread overview]
Message-ID: <CAGudoHGm2hbjSG-2kJevF=xGpz=4Sd0m5CjVO8Ntsahqz5NcGA@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpHYBqULvwNELO3Gkc0bkKDV7VJxMjvBru4zaAz4WKQNhw@mail.gmail.com>

On 8/5/23, Suren Baghdasaryan <surenb@google.com> wrote:
> On Fri, Aug 4, 2023 at 5:49 PM Mateusz Guzik <mjguzik@gmail.com> wrote:
>> However, the other users (that I know of ) go through the mmap
>> semaphore to mess with anything which means they will wait for
>> dup_mmap to finish (or do their work first). I would be surprised if
>> there were any cases which don't take the semaphore, given that it was
>> a requirement prior to the vma patchset (unless you patched some to no
>> longer need it?). I would guess worst case the semaphore can be added
>> if missing.
>
> No, the only mmap_lock read-lock that is affected is during the page
> fault, which is expected.
>

I have difficulty parsing your statement.

I am saying that any 3rd parties which can trigger page faults already
read lock mmap_lock or can be made to do it (and I don't know any case
which does not already, but I'm not willing to spend time poking
around to make sure). One can consider 3rd parties as not a problem,
modulo the audit.

Past that there does is no known source of trouble? In my original
e-mail I was worried about processes up the chain in ancestry, perhaps
some of the state is shared(?) and the locking at hand neuters any
problems. I'm guessing this is not necessary.

Bottom line though it looks like this will work fine?

That said, I'm not going to submit a patch I can't confidently defend.
As I did not dig into any of the VMA code and can't be arsed to audit
all places which mess with "foreign" mm, I'm definitely not submitting
this myself. You are most welcome to write your own variant at your
leisure. :)

-- 
Mateusz Guzik <mjguzik gmail.com>


  reply	other threads:[~2023-08-05  1:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08 19:12 [PATCH v2 1/3] mm: lock a vma before stack expansion Suren Baghdasaryan
2023-07-08 19:12 ` [PATCH v2 2/3] mm: lock newly mapped VMA which can be modified after it becomes visible Suren Baghdasaryan
2023-07-08 19:12 ` [PATCH v2 3/3] fork: lock VMAs of the parent process when forking Suren Baghdasaryan
2023-07-08 19:22   ` Suren Baghdasaryan
2023-07-08 21:18   ` Linus Torvalds
2023-07-08 22:36     ` Suren Baghdasaryan
2023-07-08 22:53       ` Linus Torvalds
2023-07-08 23:03         ` Suren Baghdasaryan
2023-08-04 21:46   ` Mateusz Guzik
2023-08-04 22:49     ` Linus Torvalds
2023-08-04 23:25       ` Mateusz Guzik
2023-08-05  0:14         ` Linus Torvalds
2023-08-05  0:26           ` Suren Baghdasaryan
2023-08-05  0:34             ` Suren Baghdasaryan
2023-08-05  0:49               ` Mateusz Guzik
2023-08-05  1:06                 ` Suren Baghdasaryan
2023-08-05  1:16                   ` Mateusz Guzik [this message]
2023-08-05  1:36                     ` Suren Baghdasaryan
2023-08-05  1:06           ` Mateusz Guzik
2023-08-05  1:42             ` Suren Baghdasaryan
2023-08-09 21:07               ` Mateusz Guzik
2023-08-10 20:31                 ` Suren Baghdasaryan

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='CAGudoHGm2hbjSG-2kJevF=xGpz=4Sd0m5CjVO8Ntsahqz5NcGA@mail.gmail.com' \
    --to=mjguzik@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bagasdotme@gmail.com \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=holger@applied-asynchrony.com \
    --cc=jacobly.alt@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=ldufour@linux.ibm.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=peterx@redhat.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.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