Re: [PATCH v3 6/6] mm/mprotect: use huge_ptep_get() for hugetlb
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-07-06 08:48:43
Also in:
linux-mm, lkml
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-07-06 08:48:43
Also in:
linux-mm, lkml
On 7/3/26 13:41, Dev Jain wrote:
prot_none_hugetlb_entry() is the hugetlb callback for the early
mprotect(PROT_NONE) PFN permission walk on x86.
The callback passes the decoded PFN to pfn_modify_allowed(). For a
hugetlb callback, the pte pointer refers to a hugetlb entry. On
architectures where hugetlb entries need huge_ptep_get(), reading that
entry with ptep_get() can make the permission check use the wrong PFN.
Use huge_ptep_get() before decoding the hugetlb PFN.
Currently there is no path which can trigger a bug: huge_ptep_get() is a
simple ptep_get() for x86, and the prot_none walk occurs only for x86.
So no need to backport - use the correct helper anyways.
Fixes: 42e4089c7890 ("x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings")
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Dev Jain <dev.jain@arm.com>
---Acked-by: David Hildenbrand (Arm) <david@kernel.org> -- Cheers, David