Bug 2307865 (CVE-2024-43892) - CVE-2024-43892 kernel: memcg: protect concurrent access to mem_cgroup_idr
Summary: CVE-2024-43892 kernel: memcg: protect concurrent access to mem_cgroup_idr
Keywords:
Status: NEW
Alias: CVE-2024-43892
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security DevOps Team
QA Contact:
URL:
Whiteboard:
Depends On: 2308173
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-08-26 11:20 UTC by OSIDB Bzimport
Modified: 2025-03-19 00:41 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2024:9635 0 None None None 2024-11-14 09:59:41 UTC
Red Hat Product Errata RHBA-2024:9811 0 None None None 2024-11-18 01:20:43 UTC
Red Hat Product Errata RHSA-2024:8856 0 None None None 2024-11-05 01:10:35 UTC
Red Hat Product Errata RHSA-2024:8870 0 None None None 2024-11-05 00:50:15 UTC
Red Hat Product Errata RHSA-2024:9315 0 None None None 2024-11-12 09:39:19 UTC
Red Hat Product Errata RHSA-2025:3021 0 None None None 2025-03-19 00:41:35 UTC

Description OSIDB Bzimport 2024-08-26 11:20:48 UTC
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.

Comment 1 Mauro Matteo Cascella 2024-08-27 14:49:13 UTC
Upstream advisory:
https://lore.kernel.org/linux-cve-announce/2024082604-CVE-2024-43892-584a@gregkh/T

Comment 5 errata-xmlrpc 2024-11-05 00:50:14 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:8870 https://access.redhat.com/errata/RHSA-2024:8870

Comment 6 errata-xmlrpc 2024-11-05 01:10:34 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:8856 https://access.redhat.com/errata/RHSA-2024:8856

Comment 7 errata-xmlrpc 2024-11-12 09:39:18 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:9315 https://access.redhat.com/errata/RHSA-2024:9315

Comment 8 errata-xmlrpc 2025-03-19 00:41:34 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.4 Extended Update Support

Via RHSA-2025:3021 https://access.redhat.com/errata/RHSA-2025:3021


Note You need to log in before you can comment on or make changes to this bug.