Re: [PATCH v1] mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW

Linus Torvalds
2022-08-09T20:46:47Z

On Tue, Aug 9, 2022 at 1:30 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> And here we are, 30 years later, and it still does that, but it leaves
> the VM_MAYSHARE flag so that /proc/<pid>/maps can show that it's a
> shared mapping.

.. thinking about it, we end up still having some things that this helps.

For example, because we clear the VM_SHARED flags for read-only shared
mappings, they don't end up going through mapping_{un}map_writable(),
and don't update i_mmap_writable, and don't cause issues with
mapping_deny_writable() or mapping_writably_mapped().

So it ends up actually having random small semantic details due to
those almost three decades of history.

I'm sure there are other odd pieces like that.

Linus