Thread (4 messages) 4 messages, 2 authors, 25d ago

Re: [PATCH] ARM: mm: align hugetlb mappings to the huge page size

flat view

From: Muchun Song <muchun.song@linux.dev>
Date: 2026-09-24 08:42:01
Also in: linux-mm, lkml

On Sep 1, 2026, at 16:57, Karl Mehltretter [off-list ref] wrote:

mmap(MAP_HUGETLB) on 32-bit Arm can return an address which is not
aligned to the huge page size. In a QEMU virt guest, unmapping the VMA
then hits the alignment check in __unmap_hugepage_range():

 kernel BUG at mm/hugetlb.c:5213!
 Internal error: Oops - BUG: 0 [#1] SMP ARM
 PC is at __unmap_hugepage_range+0x540/0x584
 LR is at __zap_vma_range+0x13a0/0x1410

Commit 7bd3f1e1a9ae ("mm: make hugetlb mappings go through
mm_get_unmapped_area_vmflags") made hugetlb mappings use the
architecture's arch_get_unmapped_area(). The generic implementations
handle hugetlb alignment, but the Arm implementations only account for
the optional SHMLBA cache-colouring constraint. A 4 KiB-page kernel can
therefore align the mapping to 4 KiB or 16 KiB instead of the required
2 MiB.

Set the alignment mask from the file's hstate for hugetlb mappings in
both Arm implementations. Huge-page alignment also satisfies the
SHMLBA constraint.

Fixes: 7bd3f1e1a9ae ("mm: make hugetlb mappings go through mm_get_unmapped_area_vmflags")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <redacted>
Besides 32-bit Arm, the same regression appears to affect MIPS and
SuperH: both support HugeTLB and provide custom arch_get_unmapped_area*()
implementations that only enforce cache-colouring alignment, not the
hstate’s huge-page alignment.

Acked-by: Muchun Song <muchun.song@linux.dev>

Thanks.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help