linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v1] mm: Fix use-after-free for MMU_GATHER_NO_GATHER
       [not found] ` <b3e305e9-26c3-d4f4-d0ce-79d79d98afe2@redhat.com>
@ 2023-07-27 11:35   ` Sven Schnelle
  0 siblings, 0 replies; only message in thread
From: Sven Schnelle @ 2023-07-27 11:35 UTC (permalink / raw)
  To: Ryan Roberts
  Cc: David Hildenbrand, Andrew Morton, Matthew Wilcox, Yin Fengwei,
	Yu Zhao, Yang Shi, Huang, Ying, Zi Yan, Nathan Chancellor,
	linux-kernel, linux-mm, linux-s390

Ryan,

David Hildenbrand <david@redhat.com> writes:

> On 27.07.23 13:02, Ryan Roberts wrote:
>> The recent change to batch-zap anonymous ptes did not take into account
>> that for platforms where MMU_GATHER_NO_GATHER is enabled (e.g. s390),
>> __tlb_remove_page() drops a reference to the page. This means that the
>> folio reference count can drop to zero while still in use (i.e. before
>> folio_remove_rmap_range() is called). This does not happen on other
>> platforms because the actual page freeing is deferred.
>> Solve this by appropriately getting/putting the folio to guarrantee
>> it
>> does not get freed early.
>> Given the new need to get/put the folio in the batch path, let's
>> stick
>> to the non-batched path if the folio is not large. In this case batching
>> is not helpful since the batch size is 1.
>> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
>> Fixes: 904d9713b3b0 ("mm: batch-zap large anonymous folio PTE mappings")
>> Reported-by: Nathan Chancellor <nathan@kernel.org>
>> Link: https://lore.kernel.org/linux-mm/20230726161942.GA1123863@dev-arch.thelio-3990X/
>> ---
>> Hi Andrew,
>> This fixes patch 3 in the series at [1], which is currently in
>> mm-unstable. I'm
>> not sure whether you want to take the fix or whether I should re-post the entire
>> series?
>> 
>
> Please repost the complete thing, you're touching some sensible places
> that really need decent review.

Please also add:

Alexander Gordeev <agordeev@linux.ibm.com>
Gerald Schaefer <gerald.schaefer@linux.ibm.com>

when reposting. Thanks!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-27 11:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230727110224.3333682-1-ryan.roberts@arm.com>
     [not found] ` <b3e305e9-26c3-d4f4-d0ce-79d79d98afe2@redhat.com>
2023-07-27 11:35   ` [PATCH v1] mm: Fix use-after-free for MMU_GATHER_NO_GATHER Sven Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).