CVE-2026-99986: drm/amdkfd: fix doorbell allocation race creating duplicate allocations
In the Linux kernel, the following vulnerability has been resolved:
drm/amdkfd: fix doorbell allocation race creating duplicate allocations
The check-and-allocate sequence on pdd->qpd.procdoorbells is lockless at every call site of kfdallocprocessdoorbells(): kfdgetprocessdoorbells() (mmap of /dev/kfd), kfdioctlcreatequeue() and the CRIU restore path each test the pointer under different locking (or none), so two racing threads can both observe NULL and each allocate a doorbell BO and bitmap, orphaning one allocation and handing the two mappings different backing pages.
Move the serialization into kfdallocprocessdoorbells() itself, using a new per-process-device mutex so all three call sites are covered regardless of their own locking. The device-global kfd->doorbellmutex is not suitable here: it is acquired under dqm->lock on the kernel-doorbell path (startcpsch() -> pminit() -> kqinitialize() -> kfdgetkerneldoorbell()), so holding it across the sleeping allocations above would create a lock-ordering inversion with dqm->lock via TTM eviction, and it would also serialize doorbell setup of unrelated processes behind a device-wide lock for per-process state.
This issue was discovered by Tencent CodeBuddy Security.
v3 (Felix Kuehling): - Removed unlocked check in kfdgetprocessdoorbell flagged as problematic by Sashiko Bot. Fall back to the locked check inside kfdallocprocessdoorbells - Added missing mutexdestroy v4 (Felix Kuehling): - Removed unlocked checks around other kfdallocprocessdoorbells calls
(cherry picked from commit 4e27ba5ad5f76932d4f6cbacd25c81c2dd40ec4a)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 4e27ba5ad5f76932d4f6cbacd25c81c2dd40ec4a
Event History
Frequently Asked Questions
What activity is required to trigger the race?
Two or more threads must concurrently reach doorbell setup for the same process-device state while proc_doorbells is still NULL. The relevant entry points are mmap of /dev/kfd, queue creation through kfd_ioctl_create_queue(), and the CRIU restore path.
What is the practical impact if the race occurs?
Racing callers can each allocate a doorbell buffer object and bitmap. One allocation can be orphaned, and the resulting mappings can use different backing pages.
Which environments should be prioritized for review?
Prioritize systems where a process can concurrently map /dev/kfd, create KFD queues, or perform CRIU restoration involving KFD state. The affected allocation state is per process-device, rather than a device-wide shared setup operation.