Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B22EE15A4B3 for ; Fri, 12 Jul 2024 12:22:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720786924; cv=none; b=dqYgyn0GBvBm8LPiHiZLTfuqzhSCZpW2Qgt3UZBZ7Zo/OVavccpChU08Wy9Ah/9ff6wT+VPgA9Aj2Jk30+JFOaNr4Ru78B4alfwJ0/mnLwmLg4dvdnVrKIaqPj5C7jZEtKuJbXImigA+IUMWu4vdzuoporQcldtdKa81owAh4v0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720786924; c=relaxed/simple; bh=x9Nj+QultepsJuvAHyoJ0GKFQ9WjZVj8w2yw4wZfzYc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TGWNGGvNLvKKDxaSe+pWi540Hi4JR9YeLmRrFR74kVj8pvIaQLIURRfwG2j0l2JMiQUpaxoqDyc4cVc/S3yIqt3S1y8hhQ1AFTL8s2OTwGZYGXelOHBsgrChCoBxj1lq6ReRL8FR95tvIX0nFDHk/ME9SdXAN5vZc4VZQeAY9Cg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zf50wqod; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zf50wqod" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32858C32782; Fri, 12 Jul 2024 12:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720786924; bh=x9Nj+QultepsJuvAHyoJ0GKFQ9WjZVj8w2yw4wZfzYc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=zf50wqod+zkZz8tR041dqbMQ4b8rlRLtlQxxJ+gXVZR4O/XJM6HlAYD7uEJiGBocm P+BMD02NHij+jJyKAstxffUWwhBcCZGmzTgnRrl4J97OV06bj8eY/wWnnLR5KtSe07 cYrvMT2/xGNhPMme5n24metDUh5qsX9FE62qJmVo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-40905: ipv6: fix possible race in __fib6_drop_pcpu_from() Date: Fri, 12 Jul 2024 14:21:23 +0200 Message-ID: <2024071208-CVE-2024-40905-44f9@gregkh> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5975; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=x9Nj+QultepsJuvAHyoJ0GKFQ9WjZVj8w2yw4wZfzYc=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkT5bdsv71/Kvs8+Ts8HatDnZddNayL2Z/1VTh51vrDW 9xS9niv7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJOD9nmO8fUGDzemZdeHxj fyWnpbzMTuuZ5gwL9uk9WrZTKXli7+OWj/8Zlv2sZQvhAAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: ipv6: fix possible race in __fib6_drop_pcpu_from() syzbot found a race in __fib6_drop_pcpu_from() [1] If compiler reads more than once (*ppcpu_rt), second read could read NULL, if another cpu clears the value in rt6_get_pcpu_route(). Add a READ_ONCE() to prevent this race. Also add rcu_read_lock()/rcu_read_unlock() because we rely on RCU protection while dereferencing pcpu_rt. [1] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000012: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097] CPU: 0 PID: 7543 Comm: kworker/u8:17 Not tainted 6.10.0-rc1-syzkaller-00013-g2bfcfd584ff5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Workqueue: netns cleanup_net RIP: 0010:__fib6_drop_pcpu_from.part.0+0x10a/0x370 net/ipv6/ip6_fib.c:984 Code: f8 48 c1 e8 03 80 3c 28 00 0f 85 16 02 00 00 4d 8b 3f 4d 85 ff 74 31 e8 74 a7 fa f7 49 8d bf 90 00 00 00 48 89 f8 48 c1 e8 03 <80> 3c 28 00 0f 85 1e 02 00 00 49 8b 87 90 00 00 00 48 8b 0c 24 48 RSP: 0018:ffffc900040df070 EFLAGS: 00010206 RAX: 0000000000000012 RBX: 0000000000000001 RCX: ffffffff89932e16 RDX: ffff888049dd1e00 RSI: ffffffff89932d7c RDI: 0000000000000091 RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000007 R10: 0000000000000001 R11: 0000000000000006 R12: ffff88807fa080b8 R13: fffffbfff1a9a07d R14: ffffed100ff41022 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b32c26000 CR3: 000000005d56e000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __fib6_drop_pcpu_from net/ipv6/ip6_fib.c:966 [inline] fib6_drop_pcpu_from net/ipv6/ip6_fib.c:1027 [inline] fib6_purge_rt+0x7f2/0x9f0 net/ipv6/ip6_fib.c:1038 fib6_del_route net/ipv6/ip6_fib.c:1998 [inline] fib6_del+0xa70/0x17b0 net/ipv6/ip6_fib.c:2043 fib6_clean_node+0x426/0x5b0 net/ipv6/ip6_fib.c:2205 fib6_walk_continue+0x44f/0x8d0 net/ipv6/ip6_fib.c:2127 fib6_walk+0x182/0x370 net/ipv6/ip6_fib.c:2175 fib6_clean_tree+0xd7/0x120 net/ipv6/ip6_fib.c:2255 __fib6_clean_all+0x100/0x2d0 net/ipv6/ip6_fib.c:2271 rt6_sync_down_dev net/ipv6/route.c:4906 [inline] rt6_disable_ip+0x7ed/0xa00 net/ipv6/route.c:4911 addrconf_ifdown.isra.0+0x117/0x1b40 net/ipv6/addrconf.c:3855 addrconf_notify+0x223/0x19e0 net/ipv6/addrconf.c:3778 notifier_call_chain+0xb9/0x410 kernel/notifier.c:93 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1992 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline] call_netdevice_notifiers net/core/dev.c:2044 [inline] dev_close_many+0x333/0x6a0 net/core/dev.c:1585 unregister_netdevice_many_notify+0x46d/0x19f0 net/core/dev.c:11193 unregister_netdevice_many net/core/dev.c:11276 [inline] default_device_exit_batch+0x85b/0xae0 net/core/dev.c:11759 ops_exit_list+0x128/0x180 net/core/net_namespace.c:178 cleanup_net+0x5b7/0xbf0 net/core/net_namespace.c:640 process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The Linux kernel CVE team has assigned CVE-2024-40905 to this issue. Affected and fixed versions =========================== Issue introduced in 4.2 with commit d52d3997f843 and fixed in 5.4.279 with commit c90af1cced2f Issue introduced in 4.2 with commit d52d3997f843 and fixed in 5.10.221 with commit c69369878766 Issue introduced in 4.2 with commit d52d3997f843 and fixed in 5.15.162 with commit a0bc020592b5 Issue introduced in 4.2 with commit d52d3997f843 and fixed in 6.1.95 with commit 2498960dac9b Issue introduced in 4.2 with commit d52d3997f843 and fixed in 6.6.35 with commit 7e796c3fefa8 Issue introduced in 4.2 with commit d52d3997f843 and fixed in 6.9.6 with commit 09e5a5a80e20 Issue introduced in 4.2 with commit d52d3997f843 and fixed in 6.10-rc3 with commit b01e1c030770 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-2024-40905 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: net/ipv6/ip6_fib.c net/ipv6/route.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/c90af1cced2f669a7b2304584be4ada495eaa0e5 https://git.kernel.org/stable/c/c693698787660c97950bc1f93a8dd19d8307153d https://git.kernel.org/stable/c/a0bc020592b54a8f3fa2b7f244b6e39e526c2e12 https://git.kernel.org/stable/c/2498960dac9b6fc49b6d1574f7cd1a4872744adf https://git.kernel.org/stable/c/7e796c3fefa8b17b30e7252886ae8cffacd2b9ef https://git.kernel.org/stable/c/09e5a5a80e205922151136069e440477d6816914 https://git.kernel.org/stable/c/b01e1c030770ff3b4fe37fc7cc6bca03f594133f