{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2021-47011",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-02-27T18:42:55.953Z",
        "datePublished": "2024-02-28T08:13:29.666Z",
        "dateUpdated": "2026-08-05T08:45:32.210Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T08:45:32.210Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmm: memcontrol: slab: fix obtain a reference to a freeing memcg\n\nPatch series \"Use obj_cgroup APIs to charge kmem pages\", v5.\n\nSince Roman's series \"The new cgroup slab memory controller\" applied.\nAll slab objects are charged with the new APIs of obj_cgroup.  The new\nAPIs introduce a struct obj_cgroup to charge slab objects.  It prevents\nlong-living objects from pinning the original memory cgroup in the\nmemory.  But there are still some corner objects (e.g.  allocations\nlarger than order-1 page on SLUB) which are not charged with the new\nAPIs.  Those objects (include the pages which are allocated from buddy\nallocator directly) are charged as kmem pages which still hold a\nreference to the memory cgroup.\n\nE.g.  We know that the kernel stack is charged as kmem pages because the\nsize of the kernel stack can be greater than 2 pages (e.g.  16KB on\nx86_64 or arm64).  If we create a thread (suppose the thread stack is\ncharged to memory cgroup A) and then move it from memory cgroup A to\nmemory cgroup B.  Because the kernel stack of the thread hold a\nreference to the memory cgroup A.  The thread can pin the memory cgroup\nA in the memory even if we remove the cgroup A.  If we want to see this\nscenario by using the following script.  We can see that the system has\nadded 500 dying cgroups (This is not a real world issue, just a script\nto show that the large kmallocs are charged as kmem pages which can pin\nthe memory cgroup in the memory).\n\n\t#!/bin/bash\n\n\tcat /proc/cgroups | grep memory\n\n\tcd /sys/fs/cgroup/memory\n\techo 1 > memory.move_charge_at_immigrate\n\n\tfor i in range{1..500}\n\tdo\n\t\tmkdir kmem_test\n\t\techo $$ > kmem_test/cgroup.procs\n\t\tsleep 3600 &\n\t\techo $$ > cgroup.procs\n\t\techo `cat kmem_test/cgroup.procs` > cgroup.procs\n\t\trmdir kmem_test\n\tdone\n\n\tcat /proc/cgroups | grep memory\n\nThis patchset aims to make those kmem pages to drop the reference to\nmemory cgroup by using the APIs of obj_cgroup.  Finally, we can see that\nthe number of the dying cgroups will not increase if we run the above test\nscript.\n\nThis patch (of 7):\n\nThe rcu_read_lock/unlock only can guarantee that the memcg will not be\nfreed, but it cannot guarantee the success of css_get (which is in the\nrefill_stock when cached memcg changed) to memcg.\n\n  rcu_read_lock()\n  memcg = obj_cgroup_memcg(old)\n  __memcg_kmem_uncharge(memcg)\n      refill_stock(memcg)\n          if (stock->cached != memcg)\n              // css_get can change the ref counter from 0 back to 1.\n              css_get(&memcg->css)\n  rcu_read_unlock()\n\nThis fix is very like the commit:\n\n  eefbfa7fd678 (\"mm: memcg/slab: fix use after free in obj_cgroup_charge\")\n\nFix this by holding a reference to the memcg which is passed to the\n__memcg_kmem_uncharge() before calling __memcg_kmem_uncharge()."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
                        "baseScore": 7.8,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:L - The vulnerable path is local memcg slab accounting (kmalloc/slab → obj_cgroup_charge → refill_obj_stock → drain_obj_stock) plus local cgroup offlining; it is not reachable from remote packet processing alone.\nAC:L - An attacker who can create and destroy memory cgroups (delegated cgroup hierarchy) controls both sides of the race—driving stock drains via accounted allocations while concurrently offlining the memcg—so success does not depend on conditions outside their influence.\nPR:L - An unprivileged local user in a non-root memory cgroup can trigger the charging path, and on common delegated setups (containers, systemd Delegate=) can create/rmdir memory cgroups without real init-namespace root.\nUI:N - No victim action is required; the attacker triggers accounted allocations and cgroup offlining with their own processes.\nS:U - Impact is confined to the local kernel’s authority (memcg/CSS use-after-free leading to local privilege escalation), with no VM, IOMMU, or other security-authority boundary crossed.\nC:H - The bug resurrects a freeing memcg via css_get on a zero refcount under RCU (explicitly likened to a prior memcg slab UAF), yielding a use-after-free that can be leveraged for arbitrary kernel memory disclosure.\nI:H - The same memcg/CSS use-after-free enables heap reuse and write primitives against freed cgroup state, which is exploitable for integrity compromise and control-flow hijacking.\nA:H - Use-after-free on memcg structures can cause kernel oops/panic or hangs when the resurrected or freed object is accessed during stock drain or later puts."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "mm/memcontrol.c"
                    ],
                    "versions": [
                        {
                            "version": "26f54dac15640c65ec69867e182de7be708ea389",
                            "lessThan": "31df8bc4d3feca9f9c6b2cd06fd64a111ae1a0e6",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "3de7d4f25a7438f09fef4e71ef111f1805cd8e7c",
                            "lessThan": "89b1ed358e01e1b0417f5d3b0082359a23355552",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "3de7d4f25a7438f09fef4e71ef111f1805cd8e7c",
                            "lessThan": "c3ae6a3f3ca4f02f6ccddf213c027302586580d0",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "3de7d4f25a7438f09fef4e71ef111f1805cd8e7c",
                            "lessThan": "9f38f03ae8d5f57371b71aa6b4275765b65454fd",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "5.10.11",
                            "lessThan": "5.10.37",
                            "status": "affected",
                            "versionType": "semver"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "mm/memcontrol.c"
                    ],
                    "versions": [
                        {
                            "version": "5.11",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "5.11",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.37",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.11.21",
                            "lessThanOrEqual": "5.11.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.12.4",
                            "lessThanOrEqual": "5.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.13",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.10.11",
                                    "versionEndExcluding": "5.10.37"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.11",
                                    "versionEndExcluding": "5.11.21"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.11",
                                    "versionEndExcluding": "5.12.4"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.11",
                                    "versionEndExcluding": "5.13"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/31df8bc4d3feca9f9c6b2cd06fd64a111ae1a0e6"
                },
                {
                    "url": "https://git.kernel.org/stable/c/89b1ed358e01e1b0417f5d3b0082359a23355552"
                },
                {
                    "url": "https://git.kernel.org/stable/c/c3ae6a3f3ca4f02f6ccddf213c027302586580d0"
                },
                {
                    "url": "https://git.kernel.org/stable/c/9f38f03ae8d5f57371b71aa6b4275765b65454fd"
                }
            ],
            "title": "mm: memcontrol: slab: fix obtain a reference to a freeing memcg",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "title": "CISA ADP Vulnrichment",
                "metrics": [
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "id": "CVE-2021-47011",
                                "role": "CISA Coordinator",
                                "options": [
                                    {
                                        "Exploitation": "none"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "partial"
                                    }
                                ],
                                "version": "2.0.3",
                                "timestamp": "2024-03-05T17:06:50.890406Z"
                            }
                        }
                    }
                ],
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2024-06-04T17:15:13.220Z"
                }
            },
            {
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2024-08-04T05:24:39.795Z"
                },
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://git.kernel.org/stable/c/31df8bc4d3feca9f9c6b2cd06fd64a111ae1a0e6",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/89b1ed358e01e1b0417f5d3b0082359a23355552",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/c3ae6a3f3ca4f02f6ccddf213c027302586580d0",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/9f38f03ae8d5f57371b71aa6b4275765b65454fd",
                        "tags": [
                            "x_transferred"
                        ]
                    }
                ]
            }
        ]
    }
}