{"id":"CVE-2026-99918","aliases":["CVE-2026-99918"],"related":[],"kind":"vulnerability","state":"published","title":"mm/madvise: atomically clear the young bit on THP MADV_COLD","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/madvise: atomically clear the young bit on THP MADV_COLD\n\nAs-is, madvise_cold_or_pageout_pte_range() discards the hardware young bit\nby invalidating the PMD, doing pmd_mkold() and subsequently writing to the\npmd again.  However, it does so in a racy manner, looking at a\npossibly-stale snapshot.  It's entirely possible that a write elsewhere\nset the hardware D bit, which this logic now loses.\n\nFix it by using pmdp_test_and_clear_young().  This is an atomic\nmodification of the PMD entry, and thus safe against any possible racing\nwrites.  As a (nice) side-effect, this elides one non-required TLB flush\nin pmdp_invalidate().\n\nThis bug can interact with the swapping system in complicated ways,\nleading to data loss.  For instance, if a folio is marked lazyfree, but\nwas later read from, and then MADV_COLD'd while racing a write to that\nsame THP, dropping the dirty bit may lead to data loss as\nreclaim/MADV_PAGEOUT drops the \"clean\" anon folio:\n\nT0                                T1\n================================================================\nMADV_FREE(thp)\t\t\t|\n  folio marked lazyfree\t\t|\nread(thp)\t\t\t|\n  PMD marked young by hardware\t|\n\t\t\t\t| MADV_COLD(thp)\nwrite(thp)\t\t\t|   if (pmd_young(pmd)) {\n  PMD marked dirty by hardware\t|     set(pmdp, pmd_mkold(pmd));\nMADV_PAGEOUT/reclaim\t\t|\n  dirty bit may or may not be   |\n  set\t\t\t\t|\n    reclaim/pageout may drop    |\n    the folio\t\t\t|","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/madvise: atomically clear the young bit on THP MADV_COLD\n\nAs-is, madvise_cold_or_pageout_pte_range() discards the hardware young bit\nby invalidating the PMD, doing pmd_mkold() and subsequently writing to the\npmd again.  However, it does so in a racy manner, looking at a\npossibly-stale snapshot.  It's entirely possible that a write elsewhere\nset the hardware D bit, which this logic now loses.\n\nFix it by using pmdp_test_and_clear_young().  This is an atomic\nmodification of the PMD entry, and thus safe against any possible racing\nwrites.  As a (nice) side-effect, this elides one non-required TLB flush\nin pmdp_invalidate().\n\nThis bug can interact with the swapping system in complicated ways,\nleading to data loss.  For instance, if a folio is marked lazyfree, but\nwas later read from, and then MADV_COLD'd while racing a write to that\nsame THP, dropping the dirty bit may lead to data loss as\nreclaim/MADV_PAGEOUT drops the \"clean\" anon folio:\n\nT0                                T1\n================================================================\nMADV_FREE(thp)\t\t\t|\n  folio marked lazyfree\t\t|\nread(thp)\t\t\t|\n  PMD marked young by hardware\t|\n\t\t\t\t| MADV_COLD(thp)\nwrite(thp)\t\t\t|   if (pmd_young(pmd)) {\n  PMD marked dirty by hardware\t|     set(pmdp, pmd_mkold(pmd));\nMADV_PAGEOUT/reclaim\t\t|\n  dirty bit may or may not be   |\n  set\t\t\t\t|\n    reclaim/pageout may drop    |\n    the folio\t\t\t|","source":"cvelist"}],"published":"2026-11-30T13:18:16.236Z","modified":"2026-11-30T14:20:27.877Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"9eeed293486a5389bc07232613ed57e875c5bdd8","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"17ee2edd085250973eb00cbd98c8b2e0f1a64eda","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"fe34430e1f0c5788160508da2265d904c6afab83","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"be48a2b1253655b4f4fdde4c950ff5c87f2ec51a","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"866940b1ccbf8061528986484eac73e44f8a1c52","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"be6be6707c2953dc4ee979e7e4605fe436d87429","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"5a4d557c02049f75c260dd5492c6e1961e49e77e","status":"affected"},{"type":"git","introduced":"9c276cc65a58faf98be8e56962745ec99ab87636","fixed":"246c8cc33438a71c28f9b86baa492d9a0a130316","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.4","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.4","status":"unaffected"},{"type":"semver","introduced":"5.10.275","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.226","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.193","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.117","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.63","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.4","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/9eeed293486a5389bc07232613ed57e875c5bdd8","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/17ee2edd085250973eb00cbd98c8b2e0f1a64eda","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/fe34430e1f0c5788160508da2265d904c6afab83","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/be48a2b1253655b4f4fdde4c950ff5c87f2ec51a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/866940b1ccbf8061528986484eac73e44f8a1c52","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/be6be6707c2953dc4ee979e7e4605fe436d87429","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/5a4d557c02049f75c260dd5492c6e1961e49e77e","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/246c8cc33438a71c28f9b86baa492d9a0a130316","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-99918","url":"https://www.cve.org/CVERecord?id=CVE-2026-99918","licence":"CVE Terms of Use","modified":"2026-11-30T13:18:16.236Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-99918","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99918","licence":"Public domain","modified":"2026-11-30T14:20:27.877Z"}],"updatedAt":"2026-11-30T14:33:43.091Z","epss":{"score":0.00326,"percentile":0.27686,"date":"2026-12-01T12:00:22.000Z"}}