KernelScan.io

HIGH Introduced in 7.1

mm HibernationSlot UAF

CVE-2026-89760

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.3MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: mm, swap: don't free a hibernation slot that is in the swap cache A slot with a folio in the swap cache is freed when the folio leaves the cache, not when its count drops. swap_put_entries_cluster() follows that rule. swap_free_hibernation_slot() does not, it calls __swap_cluster_free_entries() whether or not a folio sits on the slot. Cluster readahead can put one there. It walks a raw page_cluster sized window of offsets around the faulting entry, and a hibernation slot passes __swap_cache_add_check() because it is not a folio and its count is not zero. Freeing the slot then clears the entry under that folio. The folio is now unreachable from the swap table, and the offset goes back to the allocator. The folio is still on the LRU though, so reclaim can pick it up later. It then takes the old offset out of folio->swap and overwrites the table entry there, which by then may belong to someone else. This bug can trigger silent memory corruption, process crashes, or data instability across completely unrelated userspace applications - typically occurring when uswsusp is preparing the hibernation image. I found this while working on giving hibernation slots their own marker in the swap table, which I had discussed with Kairui. (https://lore.kernel.org/linux-mm/abp7aDgYLrxF3Me8@KASONG-MC4/) As far as I know there are no reports, so there is no Reported-by/Closes to add. Check for a cached folio before freeing. The slot is then left in the ordinary state where only the swap cache holds it, and it is freed when the folio leaves the cache, either through the reclaim below or through normal reclaim later.

02

Engine v0.6.0

Risk summary

A use-after-free in the swap subsystem allows a hibernation swap slot to be freed while a folio still references it in the swap cache. When memory reclaim later encounters the orphaned folio, it overwrites a swap table entry that may belong to an unrelated allocation, causing silent memory corruption, process crashes, or data instability. The bug requires root privileges to trigger hibernation and swap to be configured.

Affectedmm/swapfile.c (memory management / swap)

Vulnerability analysis

During hibernation image preparation, the kernel frees a swap slot unconditionally without checking whether a folio still sits on that slot in the swap cache. Cluster readahead can place a folio there, and the premature free clears the swap table entry beneath that folio, returning the offset to the allocator while the folio remains on the LRU. When reclaim later picks up the orphaned folio, it reuses the stale offset and overwrites a swap table entry that by then may belong to a different allocation, corrupting memory across unrelated processes. The fix adds a check for a cached folio before freeing the hibernation slot; if a folio is present, the slot is left in the normal state and freed only when the folio leaves the swap cache through ordinary reclaim. The vulnerable path is reachable locally by a root user initiating hibernation with swap configured.

03

BranchIntroducedFixed inPatch commit
7.27.17.2.4a6df73156f2d
mainline7.17.3-rc110d9012e83ef