[PATCH mm-hotfixes-unstable] mm: Pass page directly instead of using folio_page
David Hildenbrand
david at redhat.com
Wed Aug 6 13:21:27 PDT 2025
On 06.08.25 16:56, Dev Jain wrote:
> In commit_anon_folio_batch(), we iterate over all pages pointed to by the
> PTE batch. Therefore we need to know the first page of the batch;
> currently we derive that via folio_page(folio, 0), but, that takes us
> to the first (head) page of the folio instead - our PTE batch may lie
> in the middle of the folio, leading to incorrectness.
>
> Bite the bullet and throw away the micro-optimization of reusing the
> folio in favour of code simplicity.
Huh? We are still reusing the folio. There is a single
vm_normal_page()+page_folio() lookup in that code.
Maybe what you meant is "Simplify the code by moving the folio lookup
out of prot_numa_skip() such that we only have a single page+folio lookup."
> Derive the page and the folio in
> change_pte_range, and pass the page too to commit_anon_folio_batch to
> fix the aforementioned issue.
>
> Reported-by: syzbot+57bcc752f0df8bb1365c at syzkaller.appspotmail.com
> Fixes: cac1db8c3aad ("mm: optimize mprotect() by PTE batching")
Fell free to add a
Debugged-by: David Hildenbrand <david at redhat.com>
> Signed-off-by: Dev Jain <dev.jain at arm.com>
Acked-by: David Hildenbrand <david at redhat.com>
--
Cheers,
David / dhildenb
More information about the linux-arm-kernel
mailing list