Skip to contentSkip to conversation

CVE-2024-57920: drm/amdkfd: wq_release signals dma_fence only when available

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jan 19, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

drm/amdkfd: wq_release signals dma_fence only when available

kfd_process_wq_release() signals eviction fence by dma_fence_signal() which wanrs if dma_fence is NULL.

kfd_process->ef is initialized by kfd_process_device_init_vm() through ioctl. That means the fence is NULL for a new created kfd_process, and close a kfd_process right after open it will trigger the warning.

This commit conditionally signals the eviction fence in kfd_process_wq_release() only when it is available.

[  503.660882] WARNING: CPU: 0 PID: 9 at drivers/dma-buf/dma-fence.c:467 dma_fence_signal+0x74/0xa0
[  503.782940] Workqueue: kfd_process_wq kfd_process_wq_release [amdgpu]
[  503.789640] RIP: 0010:dma_fence_signal+0x74/0xa0
[  503.877620] Call Trace:
[  503.880066]  <TASK>
[  503.882168]  ? __warn+0xcd/0x260
[  503.885407]  ? dma_fence_signal+0x74/0xa0
[  503.889416]  ? report_bug+0x288/0x2d0
[  503.893089]  ? handle_bug+0x53/0xa0
[  503.896587]  ? exc_invalid_op+0x14/0x50
[  503.900424]  ? asm_exc_invalid_op+0x16/0x20
[  503.904616]  ? dma_fence_signal+0x74/0xa0
[  503.908626]  kfd_process_wq_release+0x6b/0x370 [amdgpu]
[  503.914081]  process_one_work+0x654/0x10a0
[  503.918186]  worker_thread+0x6c3/0xe70
[  503.921943]  ? srso_alias_return_thunk+0x5/0xfbef5
[  503.926735]  ? srso_alias_return_thunk+0x5/0xfbef5
[  503.931527]  ? __kthread_parkme+0x82/0x140
[  503.935631]  ? __pfx_worker_thread+0x10/0x10
[  503.939904]  kthread+0x2a8/0x380
[  503.943132]  ? __pfx_kthread+0x10/0x10
[  503.946882]  ret_from_fork+0x2d/0x70
[  503.950458]  ? __pfx_kthread+0x10/0x10
[  503.954210]  ret_from_fork_asm+0x1a/0x30
[  503.958142]  </TASK>
[  503.960328] ---[ end trace 0000000000000000 ]---

(cherry picked from commit 2774ef7625adb5fb9e9265c26a59dca7b8fd171e)

The Linux kernel CVE team has assigned CVE-2024-57920 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.13-rc1 with commit 967d226eaae8e40636d257bf8ae55d2c5a912f58 and fixed in 6.12.10 with commit c8243def299793ac6c85fdc1086089c800c1051a
	Issue introduced in 6.13-rc1 with commit 967d226eaae8e40636d257bf8ae55d2c5a912f58 and fixed in 6.13-rc7 with commit a993d319aebb7cce8a10c6e685344b7c2ad5c4c2

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-57920

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/amd/amdkfd/kfd_process.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/c8243def299793ac6c85fdc1086089c800c1051a
	https://git.kernel.org/stable/c/a993d319aebb7cce8a10c6e685344b7c2ad5c4c2