CVE-2024-39291: drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()
In the Linux kernel, the following vulnerability has been resolved:
drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()
The function gfx_v9_4_3_init_microcode in gfx_v9_4_3.c was generating
about potential truncation of output when using the snprintf function.
The issue was due to the size of the buffer 'ucode_prefix' being too
small to accommodate the maximum possible length of the string being
written into it.
The string being written is "amdgpu/%s_mec.bin" or "amdgpu/%s_rlc.bin",
where %s is replaced by the value of 'chip_name'. The length of this
string without the %s is 16 characters. The warning message indicated
that 'chip_name' could be up to 29 characters long, resulting in a total
of 45 characters, which exceeds the buffer size of 30 characters.
To resolve this issue, the size of the 'ucode_prefix' buffer has been
reduced from 30 to 15. This ensures that the maximum possible length of
the string being written into the buffer will not exceed its size, thus
preventing potential buffer overflow and truncation issues.
Fixes the below with gcc W=1:
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function ‘gfx_v9_4_3_early_init’:
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
379 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
| ^~
......
439 | r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
| ~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
379 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
413 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
| ^~
......
443 | r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
| ~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
413 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel AMDGPU driver issue where firmware filename construction for certain AMD graphics hardware could be truncated because a buffer was too small. The public record describes a resolved kernel bug, not a confirmed breach path. Organizations should identify affected Linux kernels using AMDGPU and consume vendor kernel updates.
Executive priority
Treat this as a targeted kernel maintenance item, not an emergency based on current evidence. Prioritize patching where Linux AMD GPU workloads are business-critical, internet-adjacent, or hard to restart later.
Technical view
In drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c, gfx_v9_4_3_init_microcode built amdgpu/%s_rlc.bin and amdgpu/%s_mec.bin with possible output up to 45 bytes against a 30-byte destination. The cited stable commits resolve the compiler-reported truncation risk in RLC and CP compute microcode initialization.
Likely exposure
Exposure appears limited to Linux systems running affected kernel versions or commit ranges with AMDGPU gfx_v9_4_3 code paths. The bundle lists Linux 6.5, 6.6.33, 6.9.4, and 6.10 as affected, but does not identify distributions, hardware models, or package names.
Exploitation context
No active exploitation is stated. The CVE is not listed as KEV in the supplied bundle, and the provided sources describe a kernel bug fix and compiler warning rather than public exploit activity or a demonstrated attack chain.
Researcher notes
Evidence is limited to the CVE record and stable kernel commits. There is no CVSS, CWE, exploit status, or distro-specific package mapping in the supplied sources. Validate impact through kernel version, AMDGPU driver use, and vendor backport status.
Mitigation direction
Update to a Linux kernel containing the referenced stable fixes.
Check your Linux distribution security advisory for packaged kernel availability.
Prioritize systems with AMDGPU hardware using affected kernel branches.
Reboot after kernel update and confirm the running kernel changed.
Track vendor guidance if your distribution has not yet mapped this CVE.
Validation and detection
Inventory Linux kernel versions across GPU-capable systems.
Identify hosts loading the amdgpu driver.
Compare kernel packages against distribution advisories for CVE-2024-39291.
Confirm patched systems are running the updated kernel after reboot.
Review kernel change logs for the referenced stable commit IDs.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2024-39291 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.