Re: [PATCH v2 1/1] mm: disallow raw PFN mappings of huge/shared zeropage
From: Zi Yan
Date: Mon Sep 21 2026 - 12:45:59 EST
On 21 Sep 2026, at 1:42, Lance Yang wrote:
> From: Lance Yang <lance.yang@xxxxxxxxx>
>
> Handling the huge/shared zeropage correctly in vmf_insert_pfn_pmd() and
> vmf_insert_pfn_prot() is more involved. We would need to check whether the
> VMA allows it and keep the mapping read-only, similar to the checks in
> vm_mixed_ok().
>
> No in-tree user needs that support, so reject these mappings with
> VM_FAULT_SIGBUS rather than complicate the code for now.
>
> Link: https://lore.kernel.org/all/20260917121010.60966-1-lance.yang@xxxxxxxxx/
> Suggested-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> Suggested-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> Signed-off-by: Lance Yang <lance.yang@xxxxxxxxx>
> ---
> v1 -> v2:
> - Reject the shared zeropage in vmf_insert_pfn_prot() (per Kiryl) - thanks!
> - Explain the VMA validation and read-only requirements (per David) - thanks!
> - Pick up Kiryl's Reviewed-by tag.
> - https://lore.kernel.org/all/20260917121010.60966-1-lance.yang@xxxxxxxxx/
>
> mm/huge_memory.c | 3 +++
> mm/memory.c | 3 +++
> 2 files changed, 6 insertions(+)
>
Makes sense to me.
Acked-by: Zi Yan <ziy@xxxxxxxxxx>
Best Regards,
Yan, Zi