HIGH Introduced in 5.18
amdkfd WaveState OOB
CVE-2026-97496
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H
KernelScan AI6.8MEDIUM
01Description
In the Linux kernel, the following vulnerability has been resolved: drm/amdkfd: Fix OOB memory exposure in get_wave_state() The get_wave_state() function for v9 trusts cp_hqd_cntl_stack_size and cp_hqd_cntl_stack_offset values read directly from the MQD, which are written by GPU microcode and fully attacker-controlled on the CRIU-restore path (via AMDKFD_IOC_RESTORE_PROCESS with H3). this leads to an unbounded copy_to_user() that can leak adjacent GTT/kernel memory. If offset > size, integer underflow produces a ~4 GiB read length, if size is set to 1 MiB against a 4 KiB allocation, we leak 1 MiB of adjacent kernel memory (other queues' MQDs, ring buffers, KASLR pointers). Fix by clamping both cp_hqd_cntl_stack_size to the actual allocated buffer size (q->ctl_stack_size) and cp_hqd_cntl_stack_offset to the clamped size before performing arithmetic and copy_to_user(). This ensures we never read beyond the allocated kernel BO regardless of attacker-supplied MQD field values.
02KernelScan AI Analysis
Risk summary
A local user with access to an AMD GPU compute device can supply crafted queue metadata on the CRIU restore path and then retrieve the saved wave state, causing the kernel to copy far more data than was actually allocated. This leaks adjacent kernel memory — including other queues' metadata, ring buffers, and kernel pointers that defeat KASLR — and an extreme size can walk off into unmapped memory and crash the kernel. Systems without AMD hardware with the KFD driver in use are not affected.
Vulnerability analysis
When an application asks the AMD compute driver to return the saved execution state of a GPU queue, the driver reads the size and offset of that state from metadata that is normally written by the GPU's own firmware. On the checkpoint/restore path, however, that metadata comes from a restored process image and is fully controlled by whoever supplies it. The driver trusted these values without checking them against the buffer it actually allocated, so a forged size or offset made it copy arbitrary amounts of kernel memory back to the caller — a large forged size leaks megabytes of neighbouring kernel data such as other queues' metadata and kernel pointers, while an offset larger than the size wraps around into a multi-gigabyte read that can run off the end of mapped memory and take the kernel down. The fix clamps the reported size and offset to the real allocated buffer before any data is copied, so the operation can never read past the queue's own allocation. The path is reachable by a local process using the AMD compute device (for example during a checkpoint/restore cycle of its own GPU workloads); it requires an AMD GPU supported by the v9 queue manager and the compute driver loaded, and is not reachable remotely or on hardware without that driver.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.12 | 5.18 | 6.12.111 | d9183d974ddd |
| 6.18 | 5.18 | 6.18.53 | ec646686613d |
| 6.6 | 5.18 | 6.6.158 | e2bef0f168be |
| mainline | 5.18 | 7.2 | 7ef144458f48 |
| cip/6.12 | 5.18 | 6.12.111-cip32 | d9183d974ddd |
04CIP Kernels
State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.
| CIP tree | State |
|---|---|
| cip/6.12 | Fixed in 6.12.111-cip32 |
| cip/6.1 | Affected — no CIP fix yet (latest 6.1.189-cip61) |
| cip/6.1-rt | Affected — no CIP fix yet (latest 6.1.189-cip61-rt32) |