CVE-2026-138970: MIPS: mm: align hugetlb mappings in arch_get_unmapped_area()
In the Linux kernel, the following vulnerability has been resolved:
MIPS: mm: align hugetlb mappings in archgetunmappedarea()
Since hugetlb mappings were made to go through the architecture's archgetunmappedarea{,topdown}(), every architecture that implements those has to align hugetlb files itself. The generic implementation and loongarch do it with hugepagemaskalign(); MIPS was left out.
A non-MAPFIXED mmap() of a hugetlbfs file therefore returns an address that is only SHMLBA aligned, and the kernel then installs 2 MB PMDs for a VMA that starts in the middle of a PMD. The consequences on an Octeon (CN63XX) board running a process that links libhugetlbfs with HUGETLBELFMAP=R and HUGETLBMORECORE=yes, all within a minute of start: the neighbouring 4 KB page table is clobbered, the TLB ends up with overlapping entries ("Caught Machine Check exception - caused by multiple matching entries in the TLB"), process exit trips BUGON(start & ~hugepagemask(h)) in unmaphugepagerange(), and freed pages leak into unrelated kernel structures (oopses in the irq maple tree, in pteoffsetmap, ...).
Do what loongarch does in commit 3109d5ff484b ("LoongArch: Set hugetlb mmap base address aligned with pmd size"): when the file is a hugetlb file, use its page mask as the search alignment instead of the cache colour mask.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In MIPS arch_get_unmapped_area(), align hugetlb file mappings using the file's page mask as the search alignment, as in LoongArch's huge_page_mask_align() approach.