Skip to content

CVE-2024-43892 memcg: protect concurrent access to mem_cgroup_idr

MediumCVSS 4.7 EPSS 0.33%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
Linux KernelUbuntuDebian

Description

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

memcg: protect concurrent access to mem_cgroup_idr

Commit 73f576c04b94 ("mm: memcontrol: fix cgroup creation failure after
many small jobs") decoupled the memcg IDs from the CSS ID space to fix the
cgroup creation failures. It introduced IDR to maintain the memcg ID
space. The IDR depends on external synchronization mechanisms for
modifications. For the mem_cgroup_idr, the idr_alloc() and idr_replace()
happen within css callback and thus are protected through cgroup_mutex
from concurrent modifications. However idr_remove() for mem_cgroup_idr
was not protected against concurrency and can be run concurrently for
different memcgs when they hit their refcnt to zero. Fix that.

We have been seeing list_lru based kernel crashes at a low frequency in
our fleet for a long time. These crashes were in different part of
list_lru code including list_lru_add(), list_lru_del() and reparenting
code. Upon further inspection, it looked like for a given object (dentry
and inode), the super_block's list_lru didn't have list_lru_one for the
memcg of that object. The initial suspicions were either the object is
not allocated through kmem_cache_alloc_lru() or somehow
memcg_list_lru_alloc() failed to allocate list_lru_one() for a memcg but
returned success. No evidence were found for these cases.

Looking more deeply, we started seeing situations where valid memcg's id
is not present in mem_cgroup_idr and in some cases multiple valid memcgs
have same id and mem_cgroup_idr is pointing to one of them. So, the most
reasonable explanation is that these situations can happen due to race
between multiple idr_remove() calls or race between
idr_alloc()/idr_replace() and idr_remove(). These races are causing
multiple memcgs to acquire the same ID and then offlining of one of them
would cleanup list_lrus on the system for all of them. Later access from
other memcgs to the list_lru cause crashes due to missing list_lru_one.

Upgrade path

10 packages: 10 fixed.

PackageAffectedFixed inStatus
debian/linux(Debian 12) < 6.1.112-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +26 more 6.1.112-1 Fixed
debian/linux(Debian 13) < 6.10.6-1 6.10.6-1 Fixed
debian/linux(Debian 14) < 6.10.6-1 6.10.6-1 Fixed
Linux kernel < 5.10.226; < 5.15.167; < 6.1.110; < 6.6.46 +17 more 4.5, 4.7, 5.10.226, 5.15.167, 6.1.110, 6.6.46, 6.10.5, 6.11, 37a060b64ae83b76600d187d76591ce488ab836b, 51c0b1bb7541f8893ec1accba59eb04361a70946, 56fd70f4aa8b82199dbe7e99366b1fd7a04d86fb, 912736a0435ef40e6a4ae78197ccb5553cb80b05, 9972605a238339b85bd16b084eed5f18414d22db, e6cc9ff2ac0b5df9f25eb790934c3104f6710278 Fixed
Microsoft cbl mariner < 5.15.167.1-2 5.15.167.1-2 Fixed
ubuntu/linux(Ubuntu 22.04) < 5.15.0-125.135 5.15.0-125.135 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-50.51 6.8.0-50.51 Fixed
ubuntu/linux-kvm(Ubuntu 22.04) < 5.15.0-1069.74 5.15.0-1069.74 Fixed
ubuntu/linux-raspi(Ubuntu 22.04) < 5.15.0-1065.68 5.15.0-1065.68 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1016.18 6.8.0-1016.18 Fixed

Affected products

ProductAffected versionsFixed in
Microsoft cbl mariner < 5.15.167.1-2 5.15.167.1-2
debian/linux(Debian:12) < 6.1.112-1 6.1.112-1
debian/linux(Debian:12) = 6.1.106-1 No fix listed
debian/linux(Debian:12) = 6.1.106-2 No fix listed
debian/linux(Debian:12) = 6.1.106-3 No fix listed
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
debian/linux(Debian:12) = 6.1.85-1 No fix listed
Show 34 more
ProductAffected versionsFixed in
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:12) = 6.1.99-1 No fix listed
debian/linux(Debian:13) < 6.10.6-1 6.10.6-1
debian/linux(Debian:14) < 6.10.6-1 6.10.6-1
ubuntu/linux(Ubuntu:22.04) < 5.15.0-125.135 5.15.0-125.135
ubuntu/linux-kvm(Ubuntu:22.04) < 5.15.0-1069.74 5.15.0-1069.74
ubuntu/linux-raspi(Ubuntu:22.04) < 5.15.0-1065.68 5.15.0-1065.68
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < 912736a0435ef40e6a4ae78197ccb5553cb80b05 912736a0435ef40e6a4ae78197ccb5553cb80b05
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < e6cc9ff2ac0b5df9f25eb790934c3104f6710278 e6cc9ff2ac0b5df9f25eb790934c3104f6710278
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < 56fd70f4aa8b82199dbe7e99366b1fd7a04d86fb 56fd70f4aa8b82199dbe7e99366b1fd7a04d86fb
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < 37a060b64ae83b76600d187d76591ce488ab836b 37a060b64ae83b76600d187d76591ce488ab836b
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < 51c0b1bb7541f8893ec1accba59eb04361a70946 51c0b1bb7541f8893ec1accba59eb04361a70946
Linux kernel >= 73f576c04b9410ed19660f74f97521bee6e1c546, < 9972605a238339b85bd16b084eed5f18414d22db 9972605a238339b85bd16b084eed5f18414d22db
Linux kernel = 8627c7750a66a46d56d3564e1e881aa53764497c No fix listed
Linux kernel = db70cd18d3da727a3a59694de428a9e41c620de7 No fix listed
Linux kernel >= 4.4.18, < 4.5 4.5
Linux kernel >= 4.6.6, < 4.7 4.7
Linux kernel = 4.7 No fix listed
Linux kernel < 5.10.226 5.10.226
Linux kernel < 5.15.167 5.15.167
Linux kernel < 6.1.110 6.1.110
Linux kernel < 6.6.46 6.6.46
Linux kernel < 6.10.5 6.10.5
Linux kernel < 6.11 6.11
ubuntu/linux(Ubuntu:24.04) < 6.8.0-50.51 6.8.0-50.51
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1016.18 6.8.0-1016.18
Linux kernel >= 4.7, < 6.6.46 6.6.46
Linux kernel >= 6.7, < 6.10.5 6.10.5
Linux kernel = 6.11-rc1 No fix listed
Linux kernel = 6.11-rc2 No fix listed

References