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 01A9145BF1 for ; Mon, 20 May 2024 09:48: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=1716198533; cv=none; b=ginrzWEGaPzizW/x44nbKegSnLhmUMc1q8P+5NDGUej67Odi3p9WJgjiSAym5d8cA9Z6nRZpT9FA3D+L1EH4zNii/XI6IUnruiqOXCjq6qu1FgzhycH/9Es1rWJg7OzpC+nxg1MJXl83Rrnk7FZMjgFC64lHNruFHIdXT3WxWWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716198533; c=relaxed/simple; bh=jVkKs0JtnKwe19oh4QzrWa842WuZaoJFfR3OS3nwpdM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RKakq7cN10RLp7s0X7aeszMh/qar5biBSvhU4zSykeE46A3/1K8nEtsDD7oteD16Vx/uukYm5C62cTWWImmtjdEAzVNdduPOhwqhQcO4RyX3z//JQ6ykiReqQxy9mupze3T19dATe9oydQ6Yy7ROkyk0ny/nJZSi4PPkxUXWE2s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FaDt+MCv; 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="FaDt+MCv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D9E4C2BD10; Mon, 20 May 2024 09:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716198532; bh=jVkKs0JtnKwe19oh4QzrWa842WuZaoJFfR3OS3nwpdM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=FaDt+MCvkepYY8hMm7WWdIX41kJH5sdTDPmAKaQ25Yjqnt/hsj9SjG5HnbynaQevY Yp2s1XY0L4L/KKD0eCz+TZRxGh29QvEBy1Jp3d4bT99OIz4UbrNFeSGITsKnsiGOTn UViL6rIVCioHxGySnA3GSjvm+JdwhuggVl64VbC4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35991: dmaengine: idxd: Convert spinlock to mutex to lock evl workqueue Date: Mon, 20 May 2024 11:48:27 +0200 Message-ID: <2024052020-CVE-2024-35991-5f06@gregkh> X-Mailer: git-send-email 2.45.1 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=3439; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jVkKs0JtnKwe19oh4QzrWa842WuZaoJFfR3OS3nwpdM=; b=owGbwMvMwCRo6H6F97bub03G02pJDGneMinXeqeGxE1zVO2Z9sp98kaHJVvFdvfXiG//efqBh Wdm84Q3HbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRytkMc8XuLlvT6dFf31He NPOz4fYpofusOxnm5wUHOnqxXdL4ePjHng8H90/pn7s5DgA= 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: dmaengine: idxd: Convert spinlock to mutex to lock evl workqueue drain_workqueue() cannot be called safely in a spinlocked context due to possible task rescheduling. In the multi-task scenario, calling queue_work() while drain_workqueue() will lead to a Call Trace as pushing a work on a draining workqueue is not permitted in spinlocked context. Call Trace: ? __warn+0x7d/0x140 ? __queue_work+0x2b2/0x440 ? report_bug+0x1f8/0x200 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x18/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? __queue_work+0x2b2/0x440 queue_work_on+0x28/0x30 idxd_misc_thread+0x303/0x5a0 [idxd] ? __schedule+0x369/0xb40 ? __pfx_irq_thread_fn+0x10/0x10 ? irq_thread+0xbc/0x1b0 irq_thread_fn+0x21/0x70 irq_thread+0x102/0x1b0 ? preempt_count_add+0x74/0xa0 ? __pfx_irq_thread_dtor+0x10/0x10 ? __pfx_irq_thread+0x10/0x10 kthread+0x103/0x140 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x31/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 The current implementation uses a spinlock to protect event log workqueue and will lead to the Call Trace due to potential task rescheduling. To address the locking issue, convert the spinlock to mutex, allowing the drain_workqueue() to be called in a safe mutex-locked context. This change ensures proper synchronization when accessing the event log workqueue, preventing potential Call Trace and improving the overall robustness of the code. The Linux kernel CVE team has assigned CVE-2024-35991 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit c40bd7d9737b and fixed in 6.6.30 with commit 758071a35d9f Issue introduced in 6.4 with commit c40bd7d9737b and fixed in 6.8.9 with commit c9b732a9f73e Issue introduced in 6.4 with commit c40bd7d9737b and fixed in 6.9 with commit d5638de827cf 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-35991 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: drivers/dma/idxd/cdev.c drivers/dma/idxd/debugfs.c drivers/dma/idxd/device.c drivers/dma/idxd/idxd.h drivers/dma/idxd/init.c drivers/dma/idxd/irq.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/758071a35d9f3ffd84ff12169d081412a2f5f098 https://git.kernel.org/stable/c/c9b732a9f73eadc638abdcf0a6d39bc7a0c1af5f https://git.kernel.org/stable/c/d5638de827cff0fce77007e426ec0ffdedf68a44