CVE-2024-42234

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-42234
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-42234.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-42234
Downstream
Published
2024-08-07T15:14:24.467Z
Modified
2025-11-28T02:35:20.476277Z
Summary
mm: fix crashes from deferred split racing folio migration
Details

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 folio_put(), 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 folioundolarge_rmappable() 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).

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/42xxx/CVE-2024-42234.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
9bcef5973e31020e5aa8571eb994d67b77318356
Fixed
fc7facce686b64201dbf0b9614cc1d0bfad70010
Fixed
be9581ea8c058d81154251cb0695987098996cad

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.9.10