CVE-2025-37958: mm/huge_memory: fix dereferencing invalid pmd migration entry
In the Linux kernel, the following vulnerability has been resolved:
mm/hugememory: fix dereferencing invalid pmd migration entry
When migrating a THP, concurrent access to the PMD migration entry during a deferred split scan can lead to an invalid address access, as illustrated below. To prevent this invalid access, it is necessary to check the PMD migration entry and return early. In this context, there is no need to use pmdtoswpentry and pfnswapentrytopage to verify the equality of the target folio. Since the PMD migration entry is locked, it cannot be served as the target.
Mailing list discussion and explanation from Hugh Dickins: "An anonvma lookup points to a location which may contain the folio of interest, but might instead contain another folio: and weeding out those other folios is precisely what the "folio != pmdfolio((pmd)" check (and the "risk of replacing the wrong folio" comment a few lines above it) is for."
BUG: unable to handle page fault for address: ffffea60001db008 CPU: 0 UID: 0 PID: 2199114 Comm: tee Not tainted 6.14.0+ #4 NONE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:splithugepmdlocked+0x3b5/0x2b60 Call Trace: <TASK> trytomigrateone+0x28c/0x3730 rmapwalkanon+0x4f6/0x770 unmapfolio+0x196/0x1f0 splithugepagetolisttoorder+0x9f6/0x1560 deferredsplitscan+0xac5/0x12a0 shrinkerdebugfsscanwrite+0x376/0x470 fullproxywrite+0x15c/0x220 vfswrite+0x2fc/0xcb0 ksyswrite+0x146/0x250 dosyscall64+0x6a/0x120 entrySYSCALL64afterhwframe+0x76/0x7e
The bug is found by syzkaller on an internal kernel, then confirmed on upstream.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1
Event History
Frequently Asked Questions
What is the severity of CVE-2025-37958?
CVE-2025-37958 has been classified with a high severity due to its potential for causing invalid memory access.
How do I fix CVE-2025-37958?
You can fix CVE-2025-37958 by upgrading to a patched version of the Linux kernel that addresses this vulnerability.
What causes the CVE-2025-37958 vulnerability?
CVE-2025-37958 is caused by concurrent access to the PMD migration entry during a deferred split scan when migrating a Transparent Huge Page (THP).
Which versions of the Linux kernel are affected by CVE-2025-37958?
CVE-2025-37958 affects Linux kernel versions starting from 6.14.0.
Is CVE-2025-37958 specific to certain Linux distributions?
CVE-2025-37958 impacts any Linux distribution using the affected versions of the Linux kernel.