Skip to main content
Vulnerability Database/CVE-2026-98520

CVE-2026-98520: Linux Kernel Use-After-Free Vulnerability

CVE-2026-98520 is a use-after-free vulnerability in the Linux kernel's drm/amdkfd driver affecting SRIOV multi-container environments. This flaw can cause system hangs and expose stale GPU mappings. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-98520 Overview

CVE-2026-98520 is a use-after-free vulnerability in the AMD Kernel Fusion Driver (drm/amdkfd) component of the Linux kernel. The flaw resides in the kfd_dev_mapping logic, which caches the address_space of the first process to open /dev/kfd. Under SR-IOV configurations with multiple containers, the cached pointer becomes dangling when the first opener's container exits. A subsequent GPU reset dereferences the freed inode inside unmap_mapping_range(), acquiring i_mmap_rwsem on freed memory and triggering a hard hang.

A secondary multi-container gap allows stale doorbell and MMIO mappings to persist in guest userspace after a GPU reset, risking PCIe transaction timeouts and NMI panics.

Critical Impact

System hangs and NMI panics on multi-container SR-IOV hosts, with potential exposure of stale doorbell/MMIO pages to guest userspace after GPU reset.

Affected Products

  • Linux kernel versions containing the drm/amdkfd driver with the vulnerable kfd_dev_mapping implementation
  • Systems using AMD GPUs under SR-IOV with multiple containers
  • Virtualized environments running the amdgpu module

Discovery Timeline

  • 2026-10-18 - CVE-2026-98520 published to NVD
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-98520

Vulnerability Analysis

The kfd_dev_mapping mechanism exists so the GPU reset path can invoke unmap_mapping_range() to zap userspace mappings of doorbell and MMIO ranges. The implementation caches the address_space of the first /dev/kfd opener globally. This single-cache design breaks under multi-tenant workloads where multiple containers open the device concurrently.

When the first opener's container terminates, its inode is released by the kernel. The cached pointer in kfd_dev_mapping continues to reference the freed inode. A later GPU reset dereferences this stale pointer inside unmap_mapping_range(), which attempts to take i_mmap_rwsem on freed memory, producing an uninterruptible rwsem wait observable as a workqueue hang on amdgpu-reset-dev.

Root Cause

The root cause is two-fold. First, the global cache stores a pointer to an inode whose lifetime is tied to a specific container rather than the module. Second, the design only tracks a single address_space, so VMAs from subsequent openers live in different address spaces and remain invisible to the reset path's unmap_mapping_range() call.

Attack Vector

Exploitation requires local access on a host running the amdgpu module with SR-IOV and multiple containers using /dev/kfd. A container owning the cached inode must exit, after which any GPU reset event triggers the use-after-free. The reset path is observable via the following stack:

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]

The secondary multi-container gap allows guest userspace to retain usable mappings to doorbell and MMIO pages with no GPU behind them, which can cause PCIe transaction timeouts.

Detection Methods for CVE-2026-98520

Indicators of Compromise

  • NMI backtraces showing amdgpu-reset-dev workqueue stuck in rwsem_down_read_slowpath()
  • Uninterruptible task warnings referencing kfd_dev_unmap_mapping_range and amdgpu_amdkfd_clear_kfd_mapping
  • PCIe transaction timeouts or NMI panics on hosts running SR-IOV AMD GPU workloads

Detection Strategies

  • Monitor kernel ring buffer and dmesg for soft lockup or hung task messages involving the amdgpu module
  • Correlate GPU reset events (xgpu_ai_mailbox_flr_work) with subsequent system instability
  • Audit running kernel versions against the fixed upstream commits 02b74891624e and c3a31087b1c8

Monitoring Recommendations

  • Enable hung_task_timeout_secs detection and forward kernel logs to a centralized log store
  • Track container lifecycle events on hosts sharing /dev/kfd across tenants
  • Alert on repeated GPU reset or FLR mailbox events, which may precede or follow the condition

How to Mitigate CVE-2026-98520

Immediate Actions Required

  • Identify hosts running the amdgpu module in SR-IOV configurations with multiple containers accessing /dev/kfd
  • Apply the upstream Linux kernel patches referenced in the fix commits as soon as distribution updates become available
  • Reboot affected systems after patching to ensure the fixed amdgpu module is loaded

Patch Information

The fix mirrors the approach used by DRM core in drm_drv.c: create a private pseudo-filesystem at module initialization and allocate one anonymous inode owned by the amdgpu module. In kfd_open(), every opener's file->f_mapping is redirected to this inode's address_space. A single unmap_mapping_range() call then reaches every container's mappings with no dangling pointer risk. See Kernel Git Commit 02b7489 and Kernel Git Commit c3a3108.

Workarounds

  • Restrict /dev/kfd access to a single container per host until patches are deployed
  • Avoid SR-IOV configurations that trigger GPU reset events on multi-tenant hosts
  • Unload the amdgpu module on systems that do not require AMD KFD functionality
bash
# Verify current kernel and amdgpu module version
uname -r
modinfo amdgpu | grep -E '^(version|srcversion):'

# Identify containers with /dev/kfd access
lsof /dev/kfd 2>/dev/null

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.