From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795154306; b=aDZlkGsvNXIv3l0Je9vnazjqTXHldo7rpwx5/oAHUkQxQLVZxaLt+vCp23/mUPLde6R0 yVcade2GQK99chdK+4lHzgahjGjN1Ug3MjWRjoSXf3U4ZzPQwqAIToQXRzEK9VgLRKsaO uAa5nSVX2gh8wUMjmro05VHc7WVdKm32JWTQp2IOmv6xzAAUDxc6z4gZFzvdyq3awzyWR iQqp/BpBqFeUGhDYi09h/Q20oVuYL0WWR8sd+qHQjwMVSMq5LSybsgnW+YgIf8+fXLQym sEYbG3YdHrB0AlJ06NvtyAf4Q1AiAS1yaadqRuRjP1sN1tMj8qE5jg72zq0nZCioPhQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795154306; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:Lines:X-Developer-Signature:X-Developer-Key: Content-Transfer-Encoding; bh=X4qiLnlYtkXv76jJnzNSN22DK232q5WGK1/1DuKyjfA=; b=F0dAijn3517MKU0TozauMPcNzDjNrNboGOgSLZ+pNKGzrsoxm+C5gLzsA+37KBpaUT1k ABOrKljtgiqaYElIfMi0Jg+oenJLckhF5QzP/ZF+OC0qyP9wCqwugGyZRr4fkxi5YIM9B gIREJ85QvSewaIJJtwrcigghu4PGRRaF7xf56HDYMnaX9Hyx4VwRLNjUL6oVCnKzVCtrE yewp+EI9mJdFlxagtLNVh94+sqvWyv3zbIgAalC8j26ZZCsQmu2Il4vtM8olZh4sfw5Tc OVtGHHE8KCcIqwCRQc8XoAl01p4cD2db4OZhAtQEW2KSriynmL6NDTLvf64Ax4gqorw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NG9h4MOc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3405860A5BC6 for ; Fri, 20 Nov 2026 05:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NG9h4MOc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C5661F000EB; Fri, 20 Nov 2026 05:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795154305; bh=X4qiLnlYtkXv76jJnzNSN22DK232q5WGK1/1DuKyjfA=; h=From:To:Cc:Subject:Date:Reply-To; b=NG9h4MOcq5W4eXCyPhaCU5ikLhzyq/bgWVb6bLdBLB1azXxpDp93wVKDQ9wU+PGfe q0yPE//Bh6ili+ef0m35bDZ8/xueRK3gNibt3dAMD0HCdjGz+mAOwsVCHcK7PgNXLX g1Q1ZpoK0IJ3q2mrot5AI4IWdPIvjKUsZgRAqB8w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99697: mm: memcontrol: fix NULL pointer deref and UAF from high_work_func() on dying memcg Date: Fri, 20 Nov 2026 06:51:23 +0100 Message-ID: <2026112000-CVE-2026-99697-bb73@gregkh> X-Mailer: git-send-email 2.56.1 Reply-To: , X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7104; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=sueGVF6lGmAfCSk0whT/lGLRPxvFVdSBcylCG2AtDPo=; b=owGbwMvMwCRo6H6F97bub03G02pJDFn/73eKTNvwdUv7aQ6p5dO0/kYKtZyNfqm7/O63CxwfN 7MEeqord8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEyj8wzC+0EZeavPRcoqj0 J5Fph+em2S6x52dYsFD7L9fBbTs8HK8mTl6rZ/nIhY+5AwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: mm: memcontrol: fix NULL pointer deref and UAF from high_work_func() on dying memcg When memory.high is exceeded in non-task context, try_charge_memcg() schedules memcg->high_work without taking a reference on the memcg, and high_work_func() invokes reclaim_high() without pinning the memcg. With obj_cgroup reparenting, introduced in commit bf4f059954dc ("mm: memcg/slab: obj_cgroup API"), objects charged to a child memcg are reparented to its parent in mem_cgroup_css_offline() instead of holding a reference on the child until uncharged. Subsequent uncharges of those objects go to the parent, which can leave the child's memory use permanently above its high limit, so any later charge on the offlined memcg in non-task context schedules high_work. This was later widened from kernel memory to LRU folios when commit f1cf8d2f36dc ("mm: memcontrol: eliminate the problem of dying memory cgroup for LRU folios") converted LRU folios to use obj_cgroup reparenting. cancel_work_sync(&memcg->high_work) only runs at the end of teardown in mem_cgroup_css_free(), so high_work_func() can start or still be running reclaim_high() after mem_cgroup_css_released() or shrink_many() has called lru_gen_release_memcg() and unhashed lruvec->lrugen.list. If reclaim tries to rotate the memcg, lru_gen_rotate_memcg() dereferences a NULL pprev pointer. This issue is specific to MGLRU and was introduced with the memcg LRU in commit e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists"). With either traditional LRU or MGLRU, css_free_rwork_fn() calls css_rstat_exit() which frees per-CPU rstat data before calling mem_cgroup_css_free(). If reclaim_high() is still running, rstat updates via mod_lruvec_state() -> __css_rstat_updated() cause a use-after-free on the per-CPU rstat data. This was introduced when commit 5da3bfa029d6 ("cgroup: use separate rstat trees for each subsystem") moved css_rstat_exit() ahead of ss->css_free(). Fix both problems by acquiring a reference with css_tryget_online() in high_work_func() before calling reclaim_high(), and by resetting memory.high and swap.high to PAGE_COUNTER_MAX in mem_cgroup_css_offline() so that charges via references on an offlined memcg do not trigger high_work on the dead child and skip checking live ancestors in try_charge_memcg(). Acquiring the reference in high_work_func() rather than before scheduling high_work is safe because mem_cgroup_css_free() calls irq_work_sync() and cancel_work_sync() which cancels pending work and waits for an already running high_work_func() to complete before mem_cgroup_free() frees the memcg. css_tryget_online() uses percpu_ref_tryget_live() and is safe to call after percpu_ref_exit() before the cgroup is freed unlike css_tryget(). Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 1 UID: 0 PID: 27 Comm: kworker/1:0 Tainted: G B W 7.3.0-rc5-g2bba28e98578 #284 PREEMPT(full) Tainted: [B]=BAD_PAGE, [W]=WARN <-- Taint from lru_gen_rotate_memcg() VM_WARN_ON_ONCE Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014 Workqueue: events high_work_func RIP: 0010:lru_gen_rotate_memcg+0x1a3/0xe90 Call Trace: ? read_ctrl_pos+0x22f/0x3f0 shrink_lruvec+0x16cb/0x1b80 ? ret_from_fork_asm+0x1a/0x30 ? lapic_next_event+0x15/0x20 ? clockevents_program_event+0x2bb/0x6f0 ? lapic_next_event+0x15/0x20 ? __pfx_shrink_lruvec+0x10/0x10 ? __pfx_clockevents_program_event+0x10/0x10 ? _raw_spin_lock+0x84/0xe0 ? __pfx__raw_spin_lock+0x10/0x10 ? kasan_save_stack+0x30/0x50 ? psi_group_change+0x381/0x740 ? __pfx_sched_clock_cpu+0x10/0x10 ? save_fpregs_to_fpstate+0xc4/0x2c0 ? finish_task_switch.isra.0+0x1de/0xac0 ? __schedule+0xf62/0x42c0 ? __pfx___schedule+0x10/0x10 ? __pfx___irq_work_queue_local+0x10/0x10 ? shrink_node+0x626/0x31e0 shrink_node+0x626/0x31e0 ? ring_buffer_unlock_commit+0x11d/0x5c0 ? kswapd_clear_hopeless+0xa0/0x150 ? __pfx_shrink_node+0x10/0x10 ? 0xffffffffc0000095 do_try_to_free_pages+0x255/0x13b0 ? ring_buffer_unlock_commit+0x11d/0x5c0 ? reclaim_high+0x10a/0x1b0 try_to_free_mem_cgroup_pages+0x1f9/0x5a0 ? __pfx_try_to_free_mem_cgroup_pages+0x10/0x10 ? irqentry_exit+0xc6/0x670 reclaim_high+0x10a/0x1b0 ? __pfx_reclaim_high+0x10/0x10 ? process_one_work+0x5ff/0x1030 ? __pfx_high_work_func+0x10/0x10 process_one_work+0x6e2/0x1030 ? __pfx___schedule+0x10/0x10 ? __pfx_process_one_work+0x10/0x10 worker_thread+0x422/0xbb0 ? __pfx_worker_thread+0x10/0x10 kthread+0x2cd/0x3a0 ? recalc_sigpending+0x15c/0x200 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x368/0x590 ? __pfx_ret_from_fork+0x10/0x10 ? __switch_to+0x588/0xf50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 The Linux kernel CVE team has assigned CVE-2026-99697 to this issue. Affected and fixed versions =========================== Issue introduced in 6.3 with commit e4dde56cd208674ce899b47589f263499e5b8cdc and fixed in 6.12.118 with commit a44855f25821082e384503abf01a45a5c65a80de Issue introduced in 6.3 with commit e4dde56cd208674ce899b47589f263499e5b8cdc and fixed in 6.18.64 with commit 301ac490daf619b8affe12b07e2d68c99adcda79 Issue introduced in 6.3 with commit e4dde56cd208674ce899b47589f263499e5b8cdc and fixed in 7.3.5 with commit b558ac673e65b4f302f105a0d9f79fb7cf012330 Issue introduced in 6.3 with commit e4dde56cd208674ce899b47589f263499e5b8cdc and fixed in 7.4-rc2 with commit dd94d8c7660a60dbfcd425e0d10120de6d02a7bd 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-99697 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/memcontrol.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/a44855f25821082e384503abf01a45a5c65a80de https://git.kernel.org/stable/c/301ac490daf619b8affe12b07e2d68c99adcda79 https://git.kernel.org/stable/c/b558ac673e65b4f302f105a0d9f79fb7cf012330 https://git.kernel.org/stable/c/dd94d8c7660a60dbfcd425e0d10120de6d02a7bd