Skip to contentSkip to conversation

CVE-2026-99649: mm/ksm: check large swap-cache folios before mapping them

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 20

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

mm/ksm: check large swap-cache folios before mapping them

KSM folios are always small, but their shared swap slots can be read back as part of a large folio in the swap cache. ksm_might_need_to_copy() skips large folios, so another process can map a page with an incompatible anon_vma or page index. Reverse mapping then cannot find the new mapping, preventing migration or reclaim.

Apply the same compatibility checks to large folios as to small ones. Pass the page corresponding to the swap entry and copy only that page when necessary. In do_swap_page()'s copy path, decrement only that slot's swap count, because the source swap-cache folio can now be large.

Fix generated by an LLM and sent by Chris Mason in private.

The Linux kernel CVE team has assigned CVE-2026-99649 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 7.0 with commit f1879e8a0c601de78a356016e216241b43de9208 and fixed in 7.3.5 with commit cc4b71683ee9d8d4ed0b25c0744314005fb3e395
	Issue introduced in 7.0 with commit f1879e8a0c601de78a356016e216241b43de9208 and fixed in 7.4-rc2 with commit 7f2c000ffb1047b476cbf267f741272c389d3e31

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-99649

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
include/linux/ksm.h
mm/ksm.c
mm/memory.c
mm/swapfile.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/cc4b71683ee9d8d4ed0b25c0744314005fb3e395
	https://git.kernel.org/stable/c/7f2c000ffb1047b476cbf267f741272c389d3e31