Re: [PATCH v2 3/3] fork: lock VMAs of the parent process when forking

From: Linus Torvalds
Date: Fri Aug 04 2023 - 18:50:05 EST


On Fri, 4 Aug 2023 at 14:46, Mateusz Guzik <mjguzik@xxxxxxxxx> wrote:
>
> I don't see it mentioned in the discussion, so at a risk of ruffling
> feathers or looking really bad I'm going to ask: is the locking of any
> use if the forking process is single-threaded? T

Sadly, we've always been able to access the mm from other processes,
so the locking is - I think - unavoidable.

And some of those "access from other processes" aren't even uncommon
or special. It's things like "ps" etc, that do it just to see the
process name and arguments.

Linus