CVE-2026-98520
published high CVSS 3.1 · 7.8drm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mapping
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux70cadefcc6160c575b04f763ada34c20e868d577 to < 02b74891624e09a5512c6d84f267d01fcc306a3b · 70cadefcc6160c575b04f763ada34c20e868d577 to < c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux7.2 (affected) · 0 to < 7.2 (unaffected · semver) · 7.2.9 through 7.2.* (unaffected · semver) · 7.3 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
| Amazon Linux | AL2 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
| Amazon Linux | AL2023 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
Description
In the Linux kernel, the following vulnerability has been resolved: drm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mapping kfd_dev_mapping caches the address_space of the first /dev/kfd opener so that the GPU reset path can call unmap_mapping_range() 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, kfd_dev_mapping becomes a dangling pointer. A subsequent GPU reset dereferences it inside unmap_mapping_range(), which takes i_mmap_rwsem on the freed inode, causing a hard hang observable as an uninterruptible rwsem wait. 2. Multi-container gap. Only the first opener's address_space is cached; VMAs created by later openers live in a different address_space and are never reached by unmap_mapping_range(). 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 (drm_drv.c): create a private pseudo-filesystem at module init time and allocate one anonymous inode from it. In kfd_open() redirect every opener's file->f_mapping to that inode's address_space. The inode is module-owned, lives exactly as long as the amdgpu module, and collects VMAs from all openers in one address_space. A single unmap_mapping_range() 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 rwsem_down_read_slowpath() with a corrupted i_mmap_rwsem: Workqueue: amdgpu-reset-dev xgpu_ai_mailbox_flr_work [amdgpu] Call Trace: <TASK> kvm_wait+0x1f/0x40 __pv_queued_spin_lock_slowpath+0x31d/0x3a0 _raw_spin_lock_irq+0x51/0x80 rwsem_down_read_slowpath+0xb3/0x550 down_read+0x48/0xd0 unmap_mapping_range+0x71/0x140 kfd_dev_unmap_mapping_range+0x5b/0x140 [amdgpu] amdgpu_amdkfd_clear_kfd_mapping+0xd8/0x190 [amdgpu] amdgpu_device_gpu_recover+0x232/0x450 [amdgpu] xgpu_ai_mailbox_flr_work+0xb5/0xc0 [amdgpu] process_one_work+0x18e/0x3e0 worker_thread+0x2e3/0x420 kthread+0x10a/0x230 (cherry picked from commit 1128b4a52de1572e87431de837fd9850cb99542c)
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - openat(2) on /dev/kfd reaches chrdev_open()->kfd_open(), which caches inode->i_mapping; local KFD queue operations can later drive kfd_hws_hang()->amdgpu_device_gpu_recover()->amdgpu_amdkfd_clear_kfd_mapping()->kfd_dev_unmap_mapping_range(). No remote protocol supplies this state. AC:L - In the affected SR-IOV multi-container setup, one tenant can exit its first GPU container to free the cached inode, then use a non-preemptible queue from another container; its unmap_queues_cpsch() timeout calls kfd_hws_hang() and schedules the reset without an uncontrolled race. PR:L - kfd_open() has no capability check, and AMDKFD_IOC_CREATE_QUEUE and AMDKFD_IOC_DESTROY_QUEUE have ioctl flags 0. The attacker needs only ordinary access to /dev/kfd as granted to a render-group user or GPU container, not init-namespace administration. UI:N - The attacker opens /dev/kfd, creates the relevant mappings and queues, exits containers, and induces queue teardown/reset through their own operations. No separate victim must open a file, mount media, or initiate the reset. S:U - The freed address_space, corrupted i_mmap_rwsem, and resulting hang or memory corruption are inside the same guest kernel running amdkfd. The code does not bypass the SR-IOV/IOMMU boundary or affect the physical host kernel. C:H - kfd_dev_mapping points to the first container inode's embedded i_data after that inode is RCU-freed; unmap_mapping_range() then reads reclaimed i_mmap and VMA pointers. Heap reclamation of this inode/mapping UAF can provide kernel-memory disclosure. I:H - unmap_mapping_range() takes and releases the freed mapping's i_mmap_rwsem and may traverse and zap through reclaimed i_mmap nodes, modifying freed inode slab and page-table state. Heap grooming can convert these UAF writes into arbitrary corruption or control-flow hijacking. A:H - The observed reset path hangs in rwsem_down_read_slowpath on the freed i_mmap_rwsem. Independently, later-container VMAs omitted from that mapping retain doorbell/MMIO access after reset, allowing PCIe transaction timeouts and NMI panics.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 70cadefcc6160c575b04f763ada34c20e868d577 to < 02b74891624e09a5512c6d84f267d01fcc306a3b (affected · git)70cadefcc6160c575b04f763ada34c20e868d577 to < c3a31087b1c8df679b653c1a09d9abe5ff7ec8ef (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 7.2 (affected)0 to < 7.2 (unaffected · semver)7.2.9 through 7.2.* (unaffected · semver)7.3 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
2Provider assertions
1Linux · cna
drm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mapping
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 7bca727f95beff26b9e90c6c0ad507c6c885edf889091ac5994242ef416a7e21
- Ingested
- 24 Oct 2026, 14:14:52 UTC
- Source record
- Official CVE record