{"id":"CVE-2026-138863","aliases":["CVE-2026-138863"],"related":[],"kind":"vulnerability","state":"published","title":"mm/mglru: fix ineffective memory protection for non-kswapd reclaim","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/mglru: fix ineffective memory protection for non-kswapd reclaim\n\nFor MGLRU, memory.min/low is not honored during global proactive reclaim\n(writing to the root memory.reclaim) and global direct reclaim, because\nthese paths shrink memcgs using stale protection (emin/elow).  It can be\nreproduced as follows:\n\n  # echo 7 > /sys/kernel/mm/lru_gen/enabled\n  # cd /sys/fs/cgroup\n  # mkdir -p a/b\n  # echo 100M > a/memory.min\n  # echo +memory > a/cgroup.subtree_control\n  # echo 100M > a/b/memory.min\n  # echo $$ > a/b/cgroup.procs\n  # dd if=/dev/zero of=/tmp/testfile bs=1M count=200\n  # cat a/b/memory.current\n  222650368\n  # echo 500M > memory.reclaim\n  -bash: echo: write error: Resource temporarily unavailable\n  # cat a/b/memory.current\n  6070272\n\nmemory.min is 100M, yet reclaim drops a/b down to 6M, breaking the\nprotection.  The traditional LRU path is not affected because\nshrink_node() calls mem_cgroup_calculate_protection() for each memcg it\nvisits during a top-down tree walk.\n\nCommit 30d77b7eef01 (\"mm/mglru: fix ineffective protection calculation\")\nmoved the protection computation into lru_gen_age_node(), which only runs\nfor kswapd.  Non-kswapd global reclaim reaches shrink_one() through\nlru_gen_shrink_node() -> shrink_many() without any protection computation,\nso emin/elow are whatever a previous kswapd run left behind - or zero if\nkswapd never ran on this node.  Relying on a prior kswapd pass is not\ncorrect either: a memcg's emin/elow are derived from its ancestors'\nmemory.min/low settings and from children_min_usage, both of which change\nover time, so emin/elow go stale even after kswapd has run and must be\nrecomputed at the point of reclaim.\n\nIntroduce mem_cgroup_calculate_protection_path() which computes emin/elow\nalong the root-to-target path only, by iterating through the cgroup\nancestors array top-down.  This avoids the full tree traversal that would\nbe needed with mem_cgroup_calculate_protection(), limiting the cost to\nO(depth) per memcg - typically 3-5 levels.\n\nCall it from shrink_one() for the non-kswapd path so that each memcg about\nto be shrunk has correct protection values.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/mglru: fix ineffective memory protection for non-kswapd reclaim\n\nFor MGLRU, memory.min/low is not honored during global proactive reclaim\n(writing to the root memory.reclaim) and global direct reclaim, because\nthese paths shrink memcgs using stale protection (emin/elow).  It can be\nreproduced as follows:\n\n  # echo 7 > /sys/kernel/mm/lru_gen/enabled\n  # cd /sys/fs/cgroup\n  # mkdir -p a/b\n  # echo 100M > a/memory.min\n  # echo +memory > a/cgroup.subtree_control\n  # echo 100M > a/b/memory.min\n  # echo $$ > a/b/cgroup.procs\n  # dd if=/dev/zero of=/tmp/testfile bs=1M count=200\n  # cat a/b/memory.current\n  222650368\n  # echo 500M > memory.reclaim\n  -bash: echo: write error: Resource temporarily unavailable\n  # cat a/b/memory.current\n  6070272\n\nmemory.min is 100M, yet reclaim drops a/b down to 6M, breaking the\nprotection.  The traditional LRU path is not affected because\nshrink_node() calls mem_cgroup_calculate_protection() for each memcg it\nvisits during a top-down tree walk.\n\nCommit 30d77b7eef01 (\"mm/mglru: fix ineffective protection calculation\")\nmoved the protection computation into lru_gen_age_node(), which only runs\nfor kswapd.  Non-kswapd global reclaim reaches shrink_one() through\nlru_gen_shrink_node() -> shrink_many() without any protection computation,\nso emin/elow are whatever a previous kswapd run left behind - or zero if\nkswapd never ran on this node.  Relying on a prior kswapd pass is not\ncorrect either: a memcg's emin/elow are derived from its ancestors'\nmemory.min/low settings and from children_min_usage, both of which change\nover time, so emin/elow go stale even after kswapd has run and must be\nrecomputed at the point of reclaim.\n\nIntroduce mem_cgroup_calculate_protection_path() which computes emin/elow\nalong the root-to-target path only, by iterating through the cgroup\nancestors array top-down.  This avoids the full tree traversal that would\nbe needed with mem_cgroup_calculate_protection(), limiting the cost to\nO(depth) per memcg - typically 3-5 levels.\n\nCall it from shrink_one() for the non-kswapd path so that each memcg about\nto be shrunk has correct protection values.","source":"cvelist"}],"published":"2026-11-30T13:25:41.357Z","modified":"2026-11-30T14:17:42.717Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"e4dde56cd208674ce899b47589f263499e5b8cdc","fixed":"b5b0c4e3096185d0da2819c8a57f3fa5cd631fb6","status":"affected"},{"type":"git","introduced":"e4dde56cd208674ce899b47589f263499e5b8cdc","fixed":"8f0b9bcb30a3e551350e71a6ddb0726761e5526d","status":"affected"},{"type":"git","introduced":"e4dde56cd208674ce899b47589f263499e5b8cdc","fixed":"2f0a531cf436c494f1b8c27ca691587b54a3d4b9","status":"affected"},{"type":"git","introduced":"e4dde56cd208674ce899b47589f263499e5b8cdc","fixed":"269a9370df2c39f741a2dd673358af397c47078a","status":"affected"},{"type":"git","introduced":"e4dde56cd208674ce899b47589f263499e5b8cdc","fixed":"15da1e4978dd4ea8f5faa6e15ee967ba4ad9a30a","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.3","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.3","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.118","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.64","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/b5b0c4e3096185d0da2819c8a57f3fa5cd631fb6","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/8f0b9bcb30a3e551350e71a6ddb0726761e5526d","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2f0a531cf436c494f1b8c27ca691587b54a3d4b9","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/269a9370df2c39f741a2dd673358af397c47078a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/15da1e4978dd4ea8f5faa6e15ee967ba4ad9a30a","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-138863","url":"https://www.cve.org/CVERecord?id=CVE-2026-138863","licence":"CVE Terms of Use","modified":"2026-11-30T13:25:41.357Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-138863","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138863","licence":"Public domain","modified":"2026-11-30T14:17:42.717Z"}],"updatedAt":"2026-11-30T14:32:21.925Z","epss":{"score":0.00209,"percentile":0.11661,"date":"2026-12-01T12:00:22.000Z"}}