{"id":"CVE-2026-142845","summary":"mm/list_lru: don't copy stale shrinker id from non-memcg-aware shrinkers","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/list_lru: don't copy stale shrinker id from non-memcg-aware shrinkers\n\nWith cgroup.memory=nokmem, shrinker_memcg_alloc() fails with -ENOSYS for\nshrinkers without SHRINKER_NONSLAB, and shrinker_alloc() falls back to a\nnon-memcg-aware shrinker.  On this fallback path, shrinker-\u003eid is never\nassigned and keeps 0 from kzalloc(), which is a valid id belonging to\nwhichever memcg-aware shrinker registers first.\n\n__list_lru_init() copies shrinker-\u003eid unconditionally, so every list_lru\nbacked by such a fallback shrinker (thp-deferred_split, zswap-shrinker,\nworkingset shadow nodes, superblock lrus, ...) ends up with\nlru-\u003eshrinker_id == 0 instead of -1.\n\nUnder nokmem the list_lru collapses to the shared per-node lists, but\n__list_lru_add() still calls set_shrinker_bit() against the memcg of\nthe added object.  Most list_lru users are unaffected because their\nobjects resolve to a NULL memcg without kmem accounting, but the THP\ndeferred split queue holds user folios, which are charged regardless of\nnokmem.  On a system where no SHRINKER_NONSLAB shrinker registers,\nshrinker_nr_max stays 0 and every memcg's shrinker_info has map_nr_max\n== 0, so the first folio added by khugepaged triggers on every boot:\n\n  WARNING: mm/shrinker.c:212 at set_shrinker_bit+0x99/0xa0\n\nOn systems where a SHRINKER_NONSLAB shrinker (btrfs, xfs) did register and\nexpand the maps, there is no warning; instead bit 0 is set spuriously for\nan unrelated shrinker.\n\nshrinker-\u003eid is only meaningful while SHRINKER_MEMCG_AWARE is set, and all\nreaders inside mm/shrinker.c already check the flag before using the id. \nMake __list_lru_init() do the same and fall back to -1, so\nset_shrinker_bit() is never reached with a bogus id.  The stale\nshrinker-\u003eid itself is left as is; cleaning that up is a separate topic.\n\nVerified on a machine booting with cgroup.memory=nokmem and\nCONFIG_TRANSPARENT_HUGEPAGE=y: the warning fires once per boot from\nkhugepaged, disappears when nokmem is removed from the command line, and\nno longer triggers with this fix applied and nokmem set.","modified":"2026-12-03T05:00:59.055523676Z","published":"2026-12-03T03:20:54.772Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142845.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6a100811c7c5fa39d452ff2e380bd14efbc0208e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/83584cc1f14d9102b612529fd26182f050f2cfad"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142845.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-142845"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"fafaeceb89a5e2e856ff04c2cacb6cae4a2ecb67"},{"fixed":"83584cc1f14d9102b612529fd26182f050f2cfad"},{"fixed":"6a100811c7c5fa39d452ff2e380bd14efbc0208e"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-142845.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"7.2.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-142845.json"}}],"schema_version":"1.9.2"}