CVE-2024-53079: mm/thp: fix deferred split unqueue naming and locking

Published Nov 19, 2024
·
Updated

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

mm/thp: fix deferred split unqueue naming and locking

Recent changes are putting more pressure on THP deferred split queues: under load revealing long-standing races, causing listdel corruptions, "Bad page state"s and worse (I keep BUGs in both of those, so usually don't get to see how badly they end up without). The relevant recent changes being 6.8's mTHP, 6.10's mTHP swapout, and 6.12's mTHP swapin, improved swap allocation, and underused THP splitting.

Before fixing locking: rename misleading folioundolargermappable(), which does not undo largermappable, to foliounqueuedeferredsplit(), which is what it does. But that and its out-of-line callee are mm internals of very limited usability: add comment and WARNONONCEs to check usage; and return a bool to say if a deferred split was unqueued, which can then be used in WARNONONCEs around safety checks (sparing callers the arcane conditionals in foliounqueuedeferredsplit()).

Just omit the foliounqueuedeferredsplit() from freeunreffolios(), all of whose callers now call it beforehand (and if any forget then badpage() will tell) - except for its caller putpageslist(), which itself no longer has any callers (and will be deleted separately).

Swapout: memcgroupswapout() has been resetting folio->memcgdata 0 without checking and unqueueing a THP folio from deferred split list; which is unfortunate, since the splitqueuelock depends on the memcg (when memcg is enabled); so swapout has been unqueueing such THPs later, when freeing the folio, using the pgdat's lock instead: potentially corrupting the memcg's list. removemapping() has frozen refcount to 0 here, so no problem with calling foliounqueuedeferredsplit() before resetting memcgdata.

That goes back to 5.4 commit 87eaceb3faa5 ("mm: thp: make deferred split shrinker memcg aware"): which included a check on swapcache before adding to deferred queue, but no check on deferred queue before adding THP to swapcache. That worked fine with the usual sequence of events in reclaim (though there were a couple of rare ways in which a THP on deferred queue could have been swapped out), but 6.12 commit dafff3f4c850 ("mm: split underused THPs") avoids splitting underused THPs in reclaim, which makes swapcache THPs on deferred queue commonplace.

Keep the check on swapcache before adding to deferred queue? Yes: it is no longer essential, but preserves the existing behaviour, and is likely to be a worthwhile optimization (vmstat showed much more traffic on the queue under swapping load if the check was removed); update its comment.

Memcg-v1 move (deprecated): memcgroupmoveaccount() has been changing folio->memcgdata without checking and unqueueing a THP folio from the deferred list, sometimes corrupting "from" memcg's list, like swapout. Refcount is non-zero here, so foliounqueuedeferredsplit() can only be used in a WARNONONCE to validate the fix, which must be done earlier: memcgroupmovechargepterange() first try to split the THP (splitting of course unqueues), or skip it if that fails. Not ideal, but moving charge has been requested, and khugepaged should repair the THP later: nobody wants new custom unqueueing code just for this deprecated case.

The 87eaceb3faa5 commit did have the code to move from one deferred list to another (but was not conscious of its unsafety while refcount non-0); but that was removed by 5.6 commit fac0516b5534 ("mm: thp: don't need care deferred split queue in memcg charge move path"), which argued that the existence of a PMD mapping guarantees that the THP cannot be on a deferred list. As above, false in rare cases, and now commonly false.

Backport to 6.11 should be straightforward. Earlier backports must take care that other deferredlist fixes and dependencies are included. There is not a strong case for backports, but they can fix cornercases.

Other sources

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

Launchpad

Affected Software

11 affected componentsFixes available
Linux Linux kernel>=5.4<6.6.62
Linux Linux kernel>=6.7<6.11.8
Linux Linux kernel=6.12-rc1
Linux Linux kernel=6.12-rc2
Linux Linux kernel=6.12-rc3
Linux Linux kernel=6.12-rc4
Linux Linux kernel=6.12-rc5
Linux Linux kernel=6.12-rc6
debian/linux<=5.10.223-1, <=5.10.234-1, <=6.1.129-1, <=6.1.135-1
6.12.25-1
Microsoft azl3 kernel 6.6.57.1-7<6.6.64.2-1
6.6.64.2-1
Microsoft azl3 kernel 6.6.64.2-1<6.6.64.2-1
6.6.64.2-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.12.25-1
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 6.6.64.2-1

Event History

Nov 19, 2024
CVE Published
via MITRE·05:45 PM
Data Sourced
via MITRE·05:45 PM
DescriptionSeverity
Data Sourced
via NVD·06:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 29, 2025
Data Sourced
via Microsoft·08:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·08:00 AM
Affected Software
Updated
via Microsoft·08:00 AM
SeverityAffected Software
Updated
via Microsoft·08:00 AM
DescriptionSeverity
Feb 20, 2025
Data Sourced
via Launchpad·12:51 AM
Description
Apr 29, 2025
Data Sourced
via Ubuntu·01:09 AM
RemedyDescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-53079?

CVE-2024-53079 has been classified as a security vulnerability that may lead to system instability under high load conditions.

2

How do I fix CVE-2024-53079?

To mitigate the impact of CVE-2024-53079, it is recommended to upgrade the Linux kernel to a patched version beyond the affected versions.

3

Which Linux kernel versions are affected by CVE-2024-53079?

CVE-2024-53079 affects Linux kernel versions from 5.4 to 6.6.62 and versions from 6.7 up to 6.11.8, as well as the 6.12 release candidates.

4

What impact does CVE-2024-53079 have on system performance?

CVE-2024-53079 may cause performance issues such as long-standing races and list_del corruptions, leading to a "Bad page state" error under load.

5

Is CVE-2024-53079 a remote or local vulnerability?

CVE-2024-53079 is considered a local vulnerability as it affects the kernel execution environment and requires local privileges to exploit.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203