arm64-make-huge_ptep_get-handled-unaligned-addresses.patch removed from -mm tree
The quilt patch titled
Subject: arm64: make huge_ptep_get handled unaligned addresses
has been removed from the -mm tree. Its filename was
arm64-make-huge_ptep_get-handled-unaligned-addresses.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Dev Jain <[email protected]>
Subject: arm64: make huge_ptep_get handled unaligned addresses
Date: Fri, 3 Jul 2026 11:41:54 +0000
Patch series "Fix incorrect access of hugetlb pte entries", v3.
There are various places which use ptep_get() to get the pte entry corresponding to a hugetlb folio. Some arches (like s390) have special handling to compute the pteval, so they provide huge_ptep_get(). Use this helper consistently.
Additionally, some code paths may provide huge_ptep_get with an unaligned address. This is a problem on arm64 (I checked other arches and it looks fine for them), which is fixed in patch 1. The fix is made to be
backport-friendly: the cleaner fix would be to perhaps pass the hstate to huge_ptep_get() - that is wider churn and we can do that later.
This patch (of 6):
huge_ptep_get() can be handed a virtual address pointing to the middle of a contpmd/contpte mapped hugetlb folio (examples of callers are pagemap_hugetlb_range, page_mapped_in_vma).
The arm64 helper rewalks the pgtables in find_num_contig to answer whether the huge pte we have maps a contpmd or a contpte hugetlb folio, and returns CONT_PMDS or CONT_PTES, so that it can collect a/d bits over the contiguous ptes. We can falsely return CONT_PTES instead of CONT_PMDS if the addr is not aligned.
THis mean that on systems where CONT_PTES != CONT_PMDS (meaning page size is 16K) we could collect excess a/d bit state, meaning extra work for the kernel.
Fix this by aligning the pmdp pointer down to a contpmd base before checking equality with the passed huge pte pointer, to correctly answer whether the huge pte is the base of a contpmd block.
---
arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/hugetlbpage.c renamed from arch/arm64/mm/hugetlbpage.c~arm64-make-huge_ptep_get-handled-unaligned-addresses +1 -1
@@ -87,7 +87,7 @@ static int find_num_contig(struct mm_str p4dp =p4d_offset (pgdp, addr); pudp =pud_offset (p4dp, addr); pmdp =pmd_offset (pudp, addr); -if ((pte_t *)pmdp == ptep) { +if ((pte_t *)PTR_ALIGN_DOWN (pmdp,sizeof (*pmdp) *CONT_PMDS ) == ptep) { *pgsize =PMD_SIZE ;return CONT_PMDS ; }
_
Patches currently in -mm which might be from [email protected] are
mm-swap-rename-subpage-page-in-folio_dup_swap-folio_put_swap.patch mm-mprotect-drop-sub-from-batching-context.patch mm-rmap-use-huge_ptep_get-in-try_to_unmap_one.patch mm-rmap-use-huge_ptep_get-in-try_to_migrate_one.patch mm-migrate-use-huge_ptep_get-in-remove_migration_pte.patch mm-page_vma_mapped-use-huge_ptep_get-for-hugetlb.patch mm-mprotect-use-huge_ptep_get-for-hugetlb.patch mm-rmap-convert-page-folio-for-hwpoison-checks.patch mm-rmap-add-try_to_unmap_hugetlb_one.patch mm-rmap-refactor-some-code-around-lazyfree-folio-unmapping.patch mm-rmap-refactor-anon-folio-unmap-in-try_to_unmap_one.patch mm-rmap-add-anon-folio-unmap-dispatcher.patch mm-memory-move-pte_install_uffd_wp_if_needed-into-memoryc.patch mm-memory-batch-set-uffd-wp-markers-during-zapping.patch mm-rmap-batch-unmap-file-folios-belonging-to-uffd-wp-vmas.patch