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 D11182C237F for ; Tue, 9 Dec 2025 04:10:50 +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=1765253451; cv=none; b=TWh+s2OBKtjXM66Gw+2rhTQ0AZuZVQtN6HI7L0yoR89JMuxgIph0grWwVRfk+TgWtF3f0iUdyquREzI2/bzTjFI/8clGCCw1UVLQSBIVyMg8aA5V039vDFAg2R0dHCEpR8e7W61JbC0378az+mF84Tv+32KlrqANQsRbHNVJQHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765253451; c=relaxed/simple; bh=icxOyzLYr6c+zIElJK8adB0+QvCRwuocJCzV1Qw7DLY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=b0DKa87l5ySW9lmIL1tmMX00NnIZLYPDOT2+SV8QthbCyhg+GDGwu9eBdhldry4iPFPYJZc2gy1BuI2oHtSFvkOuXry7Vm+K4itfZGd0LUtAfvKqTQomf/MZXzoGHyQGjPDFnpd1vv2uHdm5JljXLGdPMnCgUb3mUhR2Vrv2YWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OuzeqU8r; 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="OuzeqU8r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3882C4CEFB; Tue, 9 Dec 2025 04:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765253450; bh=icxOyzLYr6c+zIElJK8adB0+QvCRwuocJCzV1Qw7DLY=; h=From:To:Cc:Subject:Date:Reply-To:From; b=OuzeqU8rS6lJcCauhK0R/w2RCBemR/DV5Gl8roDHIR2j0tGurnxuNWQIjTSoLd7uj 4vN+1BHpivknm6zJ1/nUIotJQggH2MNhLb68BgctAvdgh8VuMSd3wuKSktL08Spb86 QdUUU5Kw2x+ke9qmSY3IFAAxFowsee5drjHXa8VE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40329: drm/sched: Fix deadlock in drm_sched_entity_kill_jobs_cb Date: Tue, 9 Dec 2025 13:10:11 +0900 Message-ID: <2025120910-CVE-2025-40329-1ead@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3805; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=tklNMMDkG0Gb3kGul2WdyCyYVInmQJTcOfomiMMSch4=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnmC5W8b1vqPwreVj8r/kHWzGclX/o36nGFPOb8mVd25 HrPw77rHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRXnWGBTs2cH7hdus6oJP+ bUfd20ncupdDuxnmcLWv+1cXwDbD9nyrH8PiDzffGi5LBAA= 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: drm/sched: Fix deadlock in drm_sched_entity_kill_jobs_cb The Mesa issue referenced below pointed out a possible deadlock: [ 1231.611031] Possible interrupt unsafe locking scenario: [ 1231.611033] CPU0 CPU1 [ 1231.611034] ---- ---- [ 1231.611035] lock(&xa->xa_lock#17); [ 1231.611038] local_irq_disable(); [ 1231.611039] lock(&fence->lock); [ 1231.611041] lock(&xa->xa_lock#17); [ 1231.611044] [ 1231.611045] lock(&fence->lock); [ 1231.611047] *** DEADLOCK *** In this example, CPU0 would be any function accessing job->dependencies through the xa_* functions that don't disable interrupts (eg: drm_sched_job_add_dependency(), drm_sched_entity_kill_jobs_cb()). CPU1 is executing drm_sched_entity_kill_jobs_cb() as a fence signalling callback so in an interrupt context. It will deadlock when trying to grab the xa_lock which is already held by CPU0. Replacing all xa_* usage by their xa_*_irq counterparts would fix this issue, but Christian pointed out another issue: dma_fence_signal takes fence.lock and so does dma_fence_add_callback. dma_fence_signal() // locks f1.lock -> drm_sched_entity_kill_jobs_cb() -> foreach dependencies -> dma_fence_add_callback() // locks f2.lock This will deadlock if f1 and f2 share the same spinlock. To fix both issues, the code iterating on dependencies and re-arming them is moved out to drm_sched_entity_kill_jobs_work(). [phasta: commit message nits] The Linux kernel CVE team has assigned CVE-2025-40329 to this issue. Affected and fixed versions =========================== Issue introduced in 6.2 with commit 2fdb8a8f07c2f1353770a324fd19b8114e4329ac and fixed in 6.6.117 with commit 70150b9443dddf02157d821c68abf438f55a2e8e Issue introduced in 6.2 with commit 2fdb8a8f07c2f1353770a324fd19b8114e4329ac and fixed in 6.12.58 with commit 0d63031ee4a57be0252cb9a4e09ae921c75cece9 Issue introduced in 6.2 with commit 2fdb8a8f07c2f1353770a324fd19b8114e4329ac and fixed in 6.17.8 with commit 3e8ada4fd838e3fd2cca94000dac054f3a347c01 Issue introduced in 6.2 with commit 2fdb8a8f07c2f1353770a324fd19b8114e4329ac and fixed in 6.18 with commit 487df8b698345dd5a91346335f05170ed5f29d4e 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-2025-40329 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/gpu/drm/scheduler/sched_entity.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/70150b9443dddf02157d821c68abf438f55a2e8e https://git.kernel.org/stable/c/0d63031ee4a57be0252cb9a4e09ae921c75cece9 https://git.kernel.org/stable/c/3e8ada4fd838e3fd2cca94000dac054f3a347c01 https://git.kernel.org/stable/c/487df8b698345dd5a91346335f05170ed5f29d4e