CVE-2026-99917: mm/swap: fix swap_cache_get_folio() returning a folio that left the swap cache

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

mm/swap: fix swapcachegetfolio() returning a folio that left the swap cache

swapcachegetfolio() reads the folio from the swap table and takes a reference with foliotryget(), without any lock. If the folio is removed from the swap cache and freed in between, and its memory gets reused, foliotryget() still succeeds and we return a page that has nothing to do with the swap entry:

CPU 0 CPU 1 doswappage() swapcachegetfolio() swptb = swaptableget() folio = swptbtofolio(swptb) madvise(MADVDONTNEED) zapnonpresentptes() swapputentriesdirect() swapputentriescluster() trytoreclaimswap() swapcachedelfolio() folioput() <- freed page reused, e.g. as an anon folio of another task foliotryget(folio) <- succeeds return folio swapupdatereadahead() <- may clear PGreadahead on it foliolockorretry() <- locks it foliomatchesswapentry() fails, unlock and put

filemapgetentry() does the same lockless lookup for the page cache, and after foliotryget() it rechecks the xarray, because the folio may have been freed and reused in between. swapcachegetfolio() lost that recheck when the swap cache moved to the swap table.

So CPU 0 writes to a folio it doesn't own: it may clear PGreadahead and takes the folio lock of someone else's page, before foliomatchesswapentry() finds out the folio is not ours.

When the race occurs, a swap fault can acquire a reference to a physical page that has been freed and reused for an unrelated purpose, potentially by another process. The fault handler may then clear that page's PGreadahead/PGreclaim flag, wait on or acquire its folio lock, and potentially attempt to remove it from an unrelated swap cache.

These operations can interfere with unrelated workloads and may cause unexpected stalls and impaired reclaim. The subsequent swap-entry validation normally prevents the wrong folio from being mapped into the faulting process.

It's documented that caller always double checks the folio so this part is harmless from the aspect of data corruption or crash.

Recheck the slot after foliotryget() and retry if it no longer holds this folio.

[akpm@linux-foundation.org: add LLM-generated description of userspace impact]

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In the Linux kernel’s swap_cache_get_folio(), recheck the swap-table slot after folio_try_get() and retry if it no longer holds the folio.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:18 PM
Data Sourced
via MITRE·01:18 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203