All of lore.kernel.org
 help / color / mirror / Atom feed
* CVE-2026-64418: mm: shrinker: fix shrinker_info teardown race with expansion
@ 2026-07-25  8:50 Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2026-07-25  8:50 UTC (permalink / raw)
  To: linux-cve-announce; +Cc: Greg Kroah-Hartman

From: Greg Kroah-Hartman <gregkh@kernel.org>

Description
===========

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

mm: shrinker: fix shrinker_info teardown race with expansion

expand_shrinker_info() iterates all visible memcgs under shrinker_mutex,
including memcgs that have not finished ->css_online() yet.

Once pn->shrinker_info has been published, teardown must stay serialized
with expand_shrinker_info() until that memcg is either fully online or no
longer visible to iteration.  Today alloc_shrinker_info() breaks that rule
by dropping shrinker_mutex before freeing a partially initialized
shrinker_info array, which may cause the following race:

CPU0                   CPU1
====                   ====

css_create
--> list_add_tail_rcu(&css->sibling, &parent_css->children);
    online_css
    --> mem_cgroup_css_online
        --> alloc_shrinker_info
            --> alloc node0 info
                rcu_assign_pointer(C->node0->shrinker_info, old0)
                alloc node1 info -> FAIL -> goto err
                mutex_unlock(shrinker_mutex)

                       shrinker_alloc()
                       --> shrinker_memcg_alloc
                           --> mutex_lock(shrinker_mutex)
                               expand_shrinker_info
                               --> mem_cgroup_iter see the memcg
                                   expand_one_shrinker_info
                                   --> old0 = C->node0->shrinker_info
                                       memcpy(new->unit, old0->unit, ...);

                free_shrinker_info
                --> kvfree(old0);

                                       /* double free !! */
                                       kvfree_rcu(old0, rcu);

The same problem exists later in mem_cgroup_css_online().  If
alloc_shrinker_info() succeeds but a subsequent objcg allocation fails,
the free_objcg -> free_shrinker_info() unwind path tears down the already
published pn->shrinker_info arrays without shrinker_mutex.  The
expand_one_shrinker_info() can race with that teardown in the same way,
leading to use-after-free or double-free of the old shrinker_info.

Fix this by serializing shrinker_info teardown with shrinker_mutex, and by
keeping alloc_shrinker_info() error cleanup inside the locked section.

The Linux kernel CVE team has assigned CVE-2026-64418 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 6.7 with commit 307bececcd1205bcb67a3c0d53a69db237ccc9d4 and fixed in 6.12.96 with commit b9a280a9a454ed514636351d53fe2a233dc5054b
	Issue introduced in 6.7 with commit 307bececcd1205bcb67a3c0d53a69db237ccc9d4 and fixed in 6.18.39 with commit 6465ff3ce65131c774a312d450abe10f4b9f3875
	Issue introduced in 6.7 with commit 307bececcd1205bcb67a3c0d53a69db237ccc9d4 and fixed in 7.1.4 with commit 284c267f013e45d8c89d9fb9373105dc8e6c0947
	Issue introduced in 6.7 with commit 307bececcd1205bcb67a3c0d53a69db237ccc9d4 and fixed in 7.2-rc3 with commit 65476d31d8056e859c48580f82295ce159196ffe

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2026-64418
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	mm/shrinker.c


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b9a280a9a454ed514636351d53fe2a233dc5054b
	https://git.kernel.org/stable/c/6465ff3ce65131c774a312d450abe10f4b9f3875
	https://git.kernel.org/stable/c/284c267f013e45d8c89d9fb9373105dc8e6c0947
	https://git.kernel.org/stable/c/65476d31d8056e859c48580f82295ce159196ffe

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-25  8:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25  8:50 CVE-2026-64418: mm: shrinker: fix shrinker_info teardown race with expansion Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.