[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5593cbb7-eb29-82f0-490e-dd72ceafff9b@redhat.com>
Date: Tue, 9 Aug 2022 21:20:42 +0200
From: David Hildenbrand <david@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Jason Gunthorpe <jgg@...dia.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
stable@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Peter Xu <peterx@...hat.com>, Hugh Dickins <hughd@...gle.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>,
John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH v1] mm/gup: fix FOLL_FORCE COW security issue and remove
FOLL_COW
On 09.08.22 21:07, Linus Torvalds wrote:
> On Tue, Aug 9, 2022 at 11:48 AM Jason Gunthorpe <jgg@...dia.com> wrote:
>>
>> It is because of all this madness with COW.
>
> Yes, yes, but we have the proper long-term pinning now with
> PG_anon_exclusive, and it actually gets the pinning right not just
> over COW, but even over a fork - which that early write never did.
>
> David, I thought all of that got properly merged? Is there something
> still missing?
The only thing to get R/O longterm pins in MAP_PRIVATE correct that's
missing is that we have to break COW when taking a R/O longterm pin when
*not* finding an anon page inside a private mapping. Regarding anon
pages I am not aware of issues (due to PG_anon_exclusive).
If anybody here wants to stare at a webpage, the following commit
explains the rough idea for MAP_PRIVATE:
https://github.com/davidhildenbrand/linux/commit/cd7989fb76d2513c86f01e6f7a74415eee5d3150
Once we have that in place, we can mostly get rid of
FOLL_FORCE|FOLL_WRITE for R/O longterm pins. There are some corner cases
though that need some additional thought which i am still working on.
FS-handled COW in MAP_SHARED mappings is just nasty (hello DAX).
(the wrong use of FOLL_GET instead of FOLL_PIN for O_DIRECT and friends
still persists, but that's a different thing to handle and it's only
problematic with concurrent fork() IIRC)
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists