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 0960916EC19 for ; Fri, 12 Jul 2024 12:33:52 +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=1720787632; cv=none; b=tTAx/UwvyA0xF7W0Ecv5vV5ZZxsAQ5P7yd+rlCG3cHGpNqpn7Kmjquzi30OrxwAUwiNju9CKxYT6ZZAsD9VBGSSctQnFW0wsVgpLRWUOkw7VZMydHupdZ3aHsUtFI/uxCBH79emM0fRVem05U2TeNAxxgLT5ClTU4m5XWbR6CIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720787632; c=relaxed/simple; bh=V+9IoZWpzrZxPeccqUU8qlmnnlcEOcRwath8NME+RFk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=StLK3xNo0SjtWxhcWYeFEOYhcyO0/gvV8WRHap8Rr/MPE6CZnOzDFqMYFJ1OnJjp8x3qVUdcPGgYUyL4N38McLU8ipw341wZ7BzLuWEzQvA6UV613/J6qm+4gyN9Jk+FktSwe+Y3ViC7bqHjX5izf7/I+Cnjl1H8rheGpVGuOYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I0DZxwzC; 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="I0DZxwzC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 822A1C32782; Fri, 12 Jul 2024 12:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720787631; bh=V+9IoZWpzrZxPeccqUU8qlmnnlcEOcRwath8NME+RFk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=I0DZxwzCglOLc8bzh5SYSMdM2jfHKmL7SqWuE4CKNpqy962JalSOr0UK6aE4hNtix hch2EPWrwp3bhXbfHfioUlvsdgVf0cV6nu7XsxlWpbvpF6sRVVUfL7viohHdAnMg1q SBAUNI7OxFufNySsojKyiUvAvBADIgdWNY0SJ2es= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-40980: drop_monitor: replace spin_lock by raw_spin_lock Date: Fri, 12 Jul 2024 14:32:56 +0200 Message-ID: <2024071231-CVE-2024-40980-cbeb@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=4643; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=V+9IoZWpzrZxPeccqUU8qlmnnlcEOcRwath8NME+RFk=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkTleLXhNm8zzb70+JidzvBLSXo+ZKzJdc17buW1zYUJ E1KYfLqiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIksMGWY7/unuPfogl/cr51/ by2eu6kvZglDHMN8p3rXpnm5B35y5B5Q4Uxbc070z8sXAA== 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: drop_monitor: replace spin_lock by raw_spin_lock trace_drop_common() is called with preemption disabled, and it acquires a spin_lock. This is problematic for RT kernels because spin_locks are sleeping locks in this configuration, which causes the following splat: BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 449, name: rcuc/47 preempt_count: 1, expected: 0 RCU nest depth: 2, expected: 2 5 locks held by rcuc/47/449: #0: ff1100086ec30a60 ((softirq_ctrl.lock)){+.+.}-{2:2}, at: __local_bh_disable_ip+0x105/0x210 #1: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: rt_spin_lock+0xbf/0x130 #2: ffffffffb394a280 (rcu_read_lock){....}-{1:2}, at: __local_bh_disable_ip+0x11c/0x210 #3: ffffffffb394a160 (rcu_callback){....}-{0:0}, at: rcu_do_batch+0x360/0xc70 #4: ff1100086ee07520 (&data->lock){+.+.}-{2:2}, at: trace_drop_common.constprop.0+0xb5/0x290 irq event stamp: 139909 hardirqs last enabled at (139908): [] _raw_spin_unlock_irqrestore+0x63/0x80 hardirqs last disabled at (139909): [] trace_drop_common.constprop.0+0x26d/0x290 softirqs last enabled at (139892): [] __local_bh_enable_ip+0x103/0x170 softirqs last disabled at (139898): [] rcu_cpu_kthread+0x93/0x1f0 Preemption disabled at: [] rt_mutex_slowunlock+0xab/0x2e0 CPU: 47 PID: 449 Comm: rcuc/47 Not tainted 6.9.0-rc2-rt1+ #7 Hardware name: Dell Inc. PowerEdge R650/0Y2G81, BIOS 1.6.5 04/15/2022 Call Trace: dump_stack_lvl+0x8c/0xd0 dump_stack+0x14/0x20 __might_resched+0x21e/0x2f0 rt_spin_lock+0x5e/0x130 ? trace_drop_common.constprop.0+0xb5/0x290 ? skb_queue_purge_reason.part.0+0x1bf/0x230 trace_drop_common.constprop.0+0xb5/0x290 ? preempt_count_sub+0x1c/0xd0 ? _raw_spin_unlock_irqrestore+0x4a/0x80 ? __pfx_trace_drop_common.constprop.0+0x10/0x10 ? rt_mutex_slowunlock+0x26a/0x2e0 ? skb_queue_purge_reason.part.0+0x1bf/0x230 ? __pfx_rt_mutex_slowunlock+0x10/0x10 ? skb_queue_purge_reason.part.0+0x1bf/0x230 trace_kfree_skb_hit+0x15/0x20 trace_kfree_skb+0xe9/0x150 kfree_skb_reason+0x7b/0x110 skb_queue_purge_reason.part.0+0x1bf/0x230 ? __pfx_skb_queue_purge_reason.part.0+0x10/0x10 ? mark_lock.part.0+0x8a/0x520 ... trace_drop_common() also disables interrupts, but this is a minor issue because we could easily replace it with a local_lock. Replace the spin_lock with raw_spin_lock to avoid sleeping in atomic context. The Linux kernel CVE team has assigned CVE-2024-40980 to this issue. Affected and fixed versions =========================== Fixed in 5.4.279 with commit 594e47957f3f Fixed in 5.10.221 with commit 96941f29ebcc Fixed in 5.15.162 with commit b3722fb69468 Fixed in 6.1.96 with commit f251ccef1d86 Fixed in 6.6.36 with commit 76ce2f912524 Fixed in 6.9.7 with commit 07ea878684df Fixed in 6.10-rc1 with commit f1e197a665c2 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-40980 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/core/drop_monitor.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/594e47957f3fe034645e6885393ce96c12286334 https://git.kernel.org/stable/c/96941f29ebcc1e9cbf570dc903f30374909562f5 https://git.kernel.org/stable/c/b3722fb69468693555f531cddda5c30444726dac https://git.kernel.org/stable/c/f251ccef1d864790e5253386e95544420b7cd8f3 https://git.kernel.org/stable/c/76ce2f9125244e1708d29c1d3f9d1d50b347bda0 https://git.kernel.org/stable/c/07ea878684dfb78a9d4f564c39d07e855a9e242e https://git.kernel.org/stable/c/f1e197a665c2148ebc25fe09c53689e60afea195