CVE-2026-98520: drm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mapping

Published Oct 18, 2026
·
Updated

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

drm/amdkfd: fix use-after-free and multi-container gap in kfddevmapping

kfddevmapping caches the addressspace of the first /dev/kfd opener so that the GPU reset path can call unmapmappingrange() to zap all userspace mappings of doorbell and MMIO ranges. This design has two bugs that both manifest under SRIOV with multiple containers:

1. Use-after-free / rwsem deadlock. The cached pointer refers to an inode owned by the first opener's container. When that container exits and its inode is released, kfddevmapping becomes a dangling pointer. A subsequent GPU reset dereferences it inside unmapmappingrange(), which takes immaprwsem on the freed inode, causing a hard hang observable as an uninterruptible rwsem wait.

2. Multi-container gap. Only the first opener's addressspace is cached; VMAs created by later openers live in a different addressspace and are never reached by unmapmappingrange(). After a GPU reset those stale mappings keep doorbell and MMIO pages accessible to guest userspace with no GPU behind them, risking PCIe transaction timeouts and NMI panics.

Fix both bugs with the same approach used by DRM core (drmdrv.c): create a private pseudo-filesystem at module init time and allocate one anonymous inode from it. In kfdopen() redirect every opener's file->fmapping to that inode's addressspace. The inode is module-owned, lives exactly as long as the amdgpu module, and collects VMAs from all openers in one addressspace. A single unmapmappingrange() call in the reset path then correctly reaches every container's mappings with no dangling pointer risk.

The hang manifests as an NMI backtrace on the GPU reset workqueue stuck spinning in rwsemdownreadslowpath() with a corrupted immaprwsem:

Workqueue: amdgpu-reset-dev xgpuaimailboxflrwork [amdgpu] Call Trace: <TASK> kvmwait+0x1f/0x40 pvqueuedspinlockslowpath+0x31d/0x3a0 rawspinlockirq+0x51/0x80 rwsemdownreadslowpath+0xb3/0x550 downread+0x48/0xd0 unmapmappingrange+0x71/0x140 kfddevunmapmappingrange+0x5b/0x140 [amdgpu] amdgpuamdkfdclearkfdmapping+0xd8/0x190 [amdgpu] amdgpudevicegpurecover+0x232/0x450 [amdgpu] xgpuaimailboxflrwork+0xb5/0xc0 [amdgpu] processonework+0x18e/0x3e0 workerthread+0x2e3/0x420 kthread+0x10a/0x230

(cherry picked from commit 1128b4a52de1572e87431de837fd9850cb99542c)

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 1128b4a52de1572e87431de837fd9850cb99542c

Event History

Oct 18, 2026
CVE Published
via MITRE·03:17 PM
Data Sourced
via MITRE·03:17 PM
Description
Data Sourced
via NVD·04:17 PM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203