From mboxrd@z Thu Jan 1 00:00:00 1970 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 402E5146593 for ; Mon, 26 Aug 2024 10:22:11 +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=1724667732; cv=none; b=KJjSyeOTxCGHboWvindyOIxiQqfMYXC+uIyABeBxV/XkSSxDDhbdH4j2nIS3TWaT+XvasEBvqnzX2ckw2BTDYdbw1oGc9M6w7MP/d7JYp9qxAhHjMePnyaBfm5LHnWEE4Wz72RoGkj1N2j3EfgB3varlzhIZwPYJtH5NjeEHnrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724667732; c=relaxed/simple; bh=YN22G9r/YelInERm4Q3t20gsAoiDNG0tyymh+OODLzQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iEZvGzIBYsc0MJh5lp84X9ukU75OSmTlva1h+0iikAC3lMmewhGqQDipp9cUp5f23yVWBt3OsPmEvIKF5ME56qq3tUA7GIpVot4nhfakNTAiDDavbNcUKmh+Z5D6Hr7T9EoOte15aBqUN/MXXuZoH4hzdZmAAwLdZzn2XXl7sVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H6HXMIQL; 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="H6HXMIQL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FF10C581B3; Mon, 26 Aug 2024 10:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724667731; bh=YN22G9r/YelInERm4Q3t20gsAoiDNG0tyymh+OODLzQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=H6HXMIQLuZBXZEVHOzRBi7PMo5DY3hGP3/zvoEAafiDEYNqV/IsfW20ptoMX11FNh MbKFR34UZB0CrQM2O5u7v9rULgWO5expYje55vWFIQ942j5dWtLFNM4n35qG3zDHsu PubA++tQc2P/yVLr8FUVPyQiQlz2sz522p7LAunY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-43887: net/tcp: Disable TCP-AO static key after RCU grace period Date: Mon, 26 Aug 2024 12:16:55 +0200 Message-ID: <2024082658-CVE-2024-43887-93bf@gregkh> X-Mailer: git-send-email 2.46.0 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=4381; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=YN22G9r/YelInERm4Q3t20gsAoiDNG0tyymh+OODLzQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlnwqTmGMY985OS2iOuzbR1v/vqqW5TzL56+xq5nF62b fu6pkt3O2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAifD8Y5gqGH9dbEVSyLbpU yUi5iSki9fYtUYb5sV+rhapfHfeQMGc+8Nt+bYzM1X8xAA== 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: net/tcp: Disable TCP-AO static key after RCU grace period The lifetime of TCP-AO static_key is the same as the last tcp_ao_info. On the socket destruction tcp_ao_info ceases to be with RCU grace period, while tcp-ao static branch is currently deferred destructed. The static key definition is : DEFINE_STATIC_KEY_DEFERRED_FALSE(tcp_ao_needed, HZ); which means that if RCU grace period is delayed by more than a second and tcp_ao_needed is in the process of disablement, other CPUs may yet see tcp_ao_info which atent dead, but soon-to-be. And that breaks the assumption of static_key_fast_inc_not_disabled(). See the comment near the definition: > * The caller must make sure that the static key can't get disabled while > * in this function. It doesn't patch jump labels, only adds a user to > * an already enabled static key. Originally it was introduced in commit eb8c507296f6 ("jump_label: Prevent key->enabled int overflow"), which is needed for the atomic contexts, one of which would be the creation of a full socket from a request socket. In that atomic context, it's known by the presence of the key (md5/ao) that the static branch is already enabled. So, the ref counter for that static branch is just incremented instead of holding the proper mutex. static_key_fast_inc_not_disabled() is just a helper for such usage case. But it must not be used if the static branch could get disabled in parallel as it's not protected by jump_label_mutex and as a result, races with jump_label_update() implementation details. Happened on netdev test-bot[1], so not a theoretical issue: [] jump_label: Fatal kernel bug, unexpected op at tcp_inbound_hash+0x1a7/0x870 [ffffffffa8c4e9b7] (eb 50 0f 1f 44 != 66 90 0f 1f 00)) size:2 type:1 [] ------------[ cut here ]------------ [] kernel BUG at arch/x86/kernel/jump_label.c:73! [] Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI [] CPU: 3 PID: 243 Comm: kworker/3:3 Not tainted 6.10.0-virtme #1 [] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [] Workqueue: events jump_label_update_timeout [] RIP: 0010:__jump_label_patch+0x2f6/0x350 ... [] Call Trace: [] [] arch_jump_label_transform_queue+0x6c/0x110 [] __jump_label_update+0xef/0x350 [] __static_key_slow_dec_cpuslocked.part.0+0x3c/0x60 [] jump_label_update_timeout+0x2c/0x40 [] process_one_work+0xe3b/0x1670 [] worker_thread+0x587/0xce0 [] kthread+0x28a/0x350 [] ret_from_fork+0x31/0x70 [] ret_from_fork_asm+0x1a/0x30 [] [] Modules linked in: veth [] ---[ end trace 0000000000000000 ]--- [] RIP: 0010:__jump_label_patch+0x2f6/0x350 [1]: https://netdev-3.bots.linux.dev/vmksft-tcp-ao-dbg/results/696681/5-connect-deny-ipv6/stderr The Linux kernel CVE team has assigned CVE-2024-43887 to this issue. Affected and fixed versions =========================== Issue introduced in 6.7 with commit 67fa83f7c86a and fixed in 6.10.5 with commit 954d55a59b25 Issue introduced in 6.7 with commit 67fa83f7c86a and fixed in 6.11-rc3 with commit 14ab4792ee12 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-43887 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/ipv4/tcp_ao.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/954d55a59b2501f4a9bd693b40ce45a1c46cb2b3 https://git.kernel.org/stable/c/14ab4792ee120c022f276a7e4768f4dcb08f0cdd