CVE-2024-42234: mm: fix crashes from deferred split racing folio migration
In the Linux kernel, the following vulnerability has been resolved:
mm: fix crashes from deferred split racing folio migration
Even on 6.10-rc6, I've been seeing elusive "Bad page state"s (often on flags when freeing, yet the flags shown are not bad: PGlocked had been set and cleared??), and VMBUGONPAGE(pagerefcount(page) == 0)s from deferredsplitscan()'s folioput(), and a variety of other BUG and WARN symptoms implying double free by deferred split and large folio migration.
6.7 commit 9bcef5973e31 ("mm: memcg: fix split queue list crash when large folio migration") was right to fix the memcg-dependent locking broken in 85ce2c517ade ("memcontrol: only transfer the memcg data for migration"), but missed a subtlety of deferredsplitscan(): it moves folios to its own local list to work on them without splitqueuelock, during which time folio->deferredlist is not empty, but even the "right" lock does nothing to secure the folio and the list it is on.
Fortunately, deferredsplitscan() is careful to use foliotryget(): so foliomigratemapping() can avoid the race by folioundolargermappable() while the old folio's reference count is temporarily frozen to 0 - adding such a freeze in the !mapping case too (originally, folio lock and unmapping and no swap cache left an anon folio unreachable, so no freezing was needed there: but the deferred split queue offers a way to reach it).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.22-1Fixed in 6.12.25-1 - Upgrade
Upgrade
Linux kernelto a version that resolves this vulnerability.Patch mm: fix crashes from deferred split racing folio migration
Event History
Frequently Asked Questions
What is the severity of CVE-2024-42234?
CVE-2024-42234 has a severity level that could result in system crashes due to issues with deferred split racing folio migration in the Linux kernel.
How do I fix CVE-2024-42234?
To resolve CVE-2024-42234, update your Linux kernel to a version that includes the fix, such as 5.10.223-1, 5.10.226-1, 6.1.119-1, or later.
Which versions of the Linux kernel are affected by CVE-2024-42234?
CVE-2024-42234 affects Linux kernel versions from 6.7 to 6.9.10.
What systems are impacted by CVE-2024-42234?
Systems running vulnerable Linux kernel versions, particularly Debian and other distributions using these kernels, are impacted by CVE-2024-42234.
Is CVE-2024-42234 fixed in the latest Linux kernel release?
Yes, CVE-2024-42234 has been resolved in the Linux kernel updates following the affected versions.