β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-2135

Missing smc_idx_lock around SMC indirect SRAM register access in radeon kv_smc.c (radeon twin of DF-2130)

Field Value
ID DF-2135
Status new
Severity Low
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:H
CWE CWE-662 Improper Synchronization; CWE-362 Race Condition
File sys/dev/drm/radeon/kv_smc.c
Lines 75-215
Area drm/radeon
Confidence certain
Discovered 2026-07-25
Reported pending
Known CVE none
CVE match dfly_specific

Summary

kv_set_smc_sram_address/kv_read_smc_sram_dword/kv_copy_bytes_to_smc drive the SMC_IND_INDEX_0 β†’ SMC_IND_DATA_0 indirect register pair (a non-atomic index/data sequence) with raw WREG32/RREG32 and never acquire rdev->smc_idx_lock. The lock exists and is documented as "protects concurrent SMC based register access" (radeon.h:2342-2343, init at radeon_device.c:1399). Every sibling radeon SMC file (ci_smc.c, si_smc.c, rv770_smc.c) and the RREG32_SMC/ WREG32_SMC accessors (ni.c:41-58) take this lock around the same register pair; kv_smc.c is the lone exception β€” the radeon twin of amdgpu DF-2130.

Root cause

Identical to DF-2130 (amdgpu twin). kv_smc.c uses raw WREG32/RREG32/WREG32_P on SMC_IND_INDEX_0/SMC_IND_DATA_0/ SMC_IND_ACCESS_CNTL without acquiring rdev->smc_idx_lock, bypassing the serialization that every sibling file (ci_smc.c:64,228,252,267; si_smc.c:62,264,288,303; rv770_smc.c:311,472,609,624) and the RREG32_SMC/WREG32_SMC macros enforce.

Threat model & preconditions

  • Attacker position: local user on a system with a Kaveri/Kabini/Mullins APU (radeon CIK KV parts) and DPM enabled.
  • Privileges gained or impact: GPU-internal: wrong dword written to or read from SMC SRAM β†’ corrupted DPM tables / voltage tables / soft registers β†’ GPU hang / display freeze / soft-lockup (local DoS recoverable by reboot). No host kernel memory corruption and no privilege escalation vector found β€” impact confined to the GPU/SMC subsystem.
  • Required config or capabilities: KV APU + radeon DPM compiled in (default).
  • Reachability: concurrent kernel-internal DPM workers; unprivileged user influences DPM activity (GPU workloads triggering power-state transitions, UVD/VCE/ACP/SAM power-gating messages, thermal/workqueue handlers reading soft registers).

Mirror ci_smc.c: acquire rdev->smc_idx_lock around the SRAM indirect access in kv_read_smc_sram_dword and kv_copy_bytes_to_smc. kv_set_smc_sram_address stays lockless (only called from within these two now-locked functions, exactly like ci_set_smc_sram_address). Every return ret; inside the locked section must be converted to a labeled epilogue that drops the lock first β€” see DF-2130 for the full diff pattern.

References

Timeline

  • 2026-07-25 Discovered during automated audit.
  • 2026-07-25 Reported to DragonFlyBSD security contact.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2135 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 699 B ↓ raw
build.sh file 161 B view raw
fix.diff file 164 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2135 - Verification Verdict

Status: reproduced (source-confirmed) Impact: none Confidence: likely

Verdict

Source-confirmed: radeon kv_smc.c SMC_IND_INDEX/DATA pair driven with raw WREG32 without smc_idx_lock; non-atomic index/data race; GPU-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/drm/radeon/kv_smc.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

radeon kv_smc no lock; GPU-gated

Verified recommended fix

radeon kv_smc no lock; GPU-gated

Verdict

radeon kv_smc no lock; GPU-gated