CVE-2026-138832: mm/madvise: reclaim isolated folios if PTE restart fails
In the Linux kernel, the following vulnerability has been resolved:
mm/madvise: reclaim isolated folios if PTE restart fails
MADVPAGEOUT collects isolated folios on a local list before reclaiming them after the PTE walk. The reschedule path drops the PTE lock and then restarts the mapping with pteoffsetmaplock().
A concurrent operation can remove or replace the PTE table while the lock is dropped, causing pteoffsetmaplock() to return NULL. Returning directly in that case bypasses reclaimpages(), leaving the collected folios off the LRU with elevated references.
This results in a permanent memory leak. nrisolatedanon increases reliably and does not decrease when the process dies.
Route the failure through the existing cleanup path so any isolated folios are reclaimed or put back.
Simplest userland pseudo-code reproducer:
p = mmap(PMDSIZE, ANONYMOUS); toucheverypage(p, PMDSIZE); parallel { while (1) madvise(p, PMDSIZE, MADVPAGEOUT); while (1) { madvise(p, PMDSIZE, MADVDONTNEED); toucheverypage(p, PMDSIZE); } }
Reproduced in qemu trivially with some explicit widening of the race window.