Skip to contentSkip to conversation

CVE-2026-99666: mm/khugepaged: fix PMD table lock leak in try_collapse_pte_mapped_thp()

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/khugepaged: fix PMD table lock leak in try_collapse_pte_mapped_thp()

For a private mapping with userfaultfd, try_collapse_pte_mapped_thp() takes the PMD table lock before it maps the page table for the second time. If that (pte_offset_map_rw_nolock) fails, because the page table vanished in the meantime due to concurrent page table reclaim, it leaves through the abort label, where the PMD table lock is unlocked if it differs from PTE table lock.

In case the PMD table lock and the PTE table lock match, which is the case without CONFIG_SPLIT_PTE_PTLOCKS after pte_offset_map_rw_nolock() failed, we miss to unlock the PMD table.

To fix it, forget the PTE table lock when we unmap+unlock the PTE table.

Fix generated by an LLM and sent by Josef Bacik in private.

[ david: move the ptl = NULL handling; rewrite description, drop wrong comments ]

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

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

	Issue introduced in 6.14 with commit 6375e95f381e3dc85065b6f74263a61522736203 and fixed in 6.18.64 with commit 7c1170ce1b74a8cd83da2174a3eb9e0755bb1b16
	Issue introduced in 6.14 with commit 6375e95f381e3dc85065b6f74263a61522736203 and fixed in 7.3.5 with commit ad5e5800ce560759c8d3c10aac15b48a06cd21c1
	Issue introduced in 6.14 with commit 6375e95f381e3dc85065b6f74263a61522736203 and fixed in 7.4-rc2 with commit db38b902307e687219ec765ef51a6ef459746c87

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-99666

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:
mm/khugepaged.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/7c1170ce1b74a8cd83da2174a3eb9e0755bb1b16
	https://git.kernel.org/stable/c/ad5e5800ce560759c8d3c10aac15b48a06cd21c1
	https://git.kernel.org/stable/c/db38b902307e687219ec765ef51a6ef459746c87