CVE-2026-99912: riscv: mm: exclude invalid THP PMDs from page table check
In the Linux kernel, the following vulnerability has been resolved:
riscv: mm: exclude invalid THP PMDs from page table check
RISC-V THP splitting uses a temporary invalid PMD state where pmdmkinvalid() clears PAGEPRESENT and PAGEPROTNONE but leaves PAGELEAF set so the MM code can still recognize the PMD as a THP split in-progress entry.
That temporary state no longer describes a user-accessible mapping, but pagetablecheck currently treats it as one because the RISC-V PMD user-accessibility test only checks whether the PMD is a leaf and has user permissions.
As a result, when a PMD-sized anonymous THP is split during a COW fault, pagetablecheck can account the invalid intermediate PMD as a live PMD mapping, and then account the replacement PTE mappings again when the split installs the PTE table. This leaves stale PMD accounting behind and later triggers pagetablecheck failures such as a non-zero anonmapcount when the folio is freed.
Fix this by tightening pmduseraccessiblepage() so PMD page-table-check accounting only considers leaf PMDs that still carry either PAGEPRESENT or PAGEPROTNONE. This preserves the THP split semantics required by the MM code while preventing pagetablecheck from treating invalid split PMDs as live user mappings.
With CONFIGPAGETABLECHECK=y and CONFIGPAGETABLECHECKENFORCED=y, tools/testing/selftests/mm/cow completes successfully on RISC-V after this change.
Affected Software
Event History
Frequently Asked Questions
Which systems and workloads are affected by this accounting failure?
It affects RISC-V Linux kernel systems when a PMD-sized anonymous transparent huge page is split during a copy-on-write fault. The issue involves the temporary invalid PMD state used while that split is in progress.
How can I tell whether this issue has occurred?
The stale accounting can later trigger page_table_check failures when the affected folio is freed. One reported symptom is a non-zero anon_map_count at folio free time.
What condition is corrected by the fix?
The fix prevents page-table-check accounting from treating a temporary invalid THP PMD as a live user-accessible PMD mapping. Such PMDs are counted only if they remain leaf PMDs and carry either _PAGE_PRESENT or _PAGE_PROT_NONE.