CVE-2024-56695·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: drm/amdkfd: Use dynamic allocation for CU occupancy array in 'kfd_get_cu_occupancy()' The `kfd_get_cu_occupancy` function previously declared a large `cu_occupancy` array as a local variable, which could lead to stack overflows due to excessive stack usage. This commit replaces the static array allocation with dynamic memory allocation using `kcalloc`, thereby reducing the stack size. This change avoids the risk of stack overflows in kernel space, in scenarios where `AMDGPU_MAX_QUEUES` is large. The allocated memory is freed using `kfree` before the function returns to prevent memory leaks. Fixes the below with gcc W=1: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c: In function ‘kfd_get_cu_occupancy’: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:322:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=] 322 | } | ^
- Severity
- high
- Software
- Kernel
- Fixed in
- 6.12.2
- Published
- 2024-12-28
Affected versions
From: 6.12
Until: 6.12.2
Fixed in: 6.12.2
How to fix this CVE
Update your Linux kernel to version 6.12.2 or later to resolve this stack overflow vulnerability in the AMD KFD driver. The fix converts a large static array allocation to dynamic memory allocation, preventing kernel stack exhaustion during GPU compute unit occupancy queries. Apply the kernel update through your distribution's package manager and reboot your system to activate the patch.
sudo dnf update kernel kernel-devel && sudo rebootDefensia detects this vulnerability
How to check if you are affected
- Check your current kernel version with: uname -r
- Verify if AMD GPU drivers are active by running: lsmod | grep amdgpu or lsmod | grep amdkfd
- Review kernel logs for stack overflow warnings: sudo dmesg | grep -i 'stack\|overflow\|frame size'
- Confirm the patch is applied by checking kernel build info: cat /proc/version and cross-reference against kernel 6.12.2 release notes
FAQ
What is CVE-2024-56695?
This vulnerability is a kernel stack overflow in the AMD KFD (Kernel Fusion Driver) GPU compute stack. The kfd_get_cu_occupancy() function used excessive stack memory with a large statically-allocated array, risking kernel crashes or undefined behavior when the GPU driver queries compute unit occupancy information.
Is CVE-2024-56695 being actively exploited?
No, this vulnerability is not listed on the CISA Known Exploited Vulnerabilities catalog and no public exploits are currently available. However, it still poses a stability risk for systems running vulnerable kernel versions with AMD GPUs.
What versions of Kernel are affected by CVE-2024-56695?
Linux kernel versions 6.12 through 6.12.1 are affected. Version 6.12.2 and later contain the fix.
How do I check if my server is vulnerable to CVE-2024-56695?
Run: uname -r to see your kernel version. If the output shows 6.12.0 or 6.12.1 and you have AMD GPU drivers active (check with: lsmod | grep amdkfd), your system is vulnerable.
Does Defensia detect CVE-2024-56695?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2024-56695 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-56695. Free for 1 server.
Get started free