VBIOS-controlled vdd_dep_on_sclk->count drives Sclk_voltageOffset[8] heap overflow in clock stretcher
Summary
tonga_populate_clock_stretcher_data_table at tonga_smumgr.c:1620: for(i=0;i<sclk_table->count;i++) writes smc_state_table.Sclk_voltageOffset[i] (uint8_t[8], smu72_discrete.h:344). sclk_table->count from VBIOS ucNumEntries (u8 1-255). i>=8 -> overflow into ClockStretcherDataTable/CKS_LOOKUPTable/past DpmTable into power_tune_defaults ptr. Gated by VBIOS-controlled PHM_PlatformCaps_ClockStretcher. Crafted VBIOS. Fix: clamp i<SMU72_MAX_LEVELS_GRAPHICS.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1272 Β· 11 files| File | Type | Description | Size | |
|---|---|---|---|---|
| tonga_sclk_voltage_offset_overflow.c | trigger-source | trigger / documentation PoC | 1.5 KB | view raw |
| fix.diff | suggested-fix | git-apply-able patch closing the cited path | 680 B | view raw |
| VERDICT.md | verdict | full source trace + reachability + fix analysis | 2.8 KB | β raw |
| README.md | readme | build/run/expected | 1.4 KB | β raw |
| build.sh | build-script | cc -O2 -Wall -o tonga_sclk_voltage_offset_overflow tonga_sclk_voltage_offset_overflow.c | 174 B | view raw |
| run.sh | run-script | ./tonga_sclk_voltage_offset_overflow | 68 B | view raw |
| run.log | run-log | decisive run, full output | 345 B | view raw |
| fix_build.log | build-log | nativekernel compile-validation excerpt, rc=0 | 32.5 KB | view raw |
| env.txt | environment | uname, cc version, device/module state | 583 B | view raw |
| ../fix_build_combined.log | build-log | Combined 41-finding kernel build (rc=0, -Werror clean) | 5.6 MB | β download |
| ../fix_build_summary.txt | build-summary | Summary of the combined 41-finding kernel build | 826 B | view raw |
DF-1272 PoC β tonga sclk_table->count Sclk_voltageOffset overflow
Status
INCONCLUSIVE on the audit guest: bug confirmed real by source trace at
sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c:1620, but hardware-gated and not triggerable here. fix.diff authored and
validated to apply + compile (nativekernel rc=0, -Werror). See
VERDICT.md for the full trace and fix.diff for the patch.
Build
./build.sh
(equivalent: cc -O2 -Wall -o tonga_sclk_voltage_offset_overflow tonga_sclk_voltage_offset_overflow.c)
Run (as unprivileged user)
./run.sh
Expected on the audit guest
The PoC runs and reports that the kernel trigger surface is absent on this
QEMU/KVM guest (no LSI MegaRAID controller / no AMD Tonga GPU / no DP MST
hardware; mfi is in-kernel but /dev/mfi0 is never created; drm/amdgpu are
loadable modules that are not loaded and would not attach). It exits 0 without
exercising the sink. The bug is therefore a latent, hardware-dependent
defect, not a false positive.
Files
tonga_sclk_voltage_offset_overflow.cβ trigger / documentation PoCfix.diffβ standalonegit apply -p1patch closing the cited pathVERDICT.mdβ full source-level mechanism + reachability + fix analysisbuild.log/run.logβ captured build/run outputfix_build.logβ nativekernel compile-validation excerpt (rc=0)env.txtβ guest environmentmanifest.jsonβ machine-readable artifact catalog
DF-1272 β tonga VBIOS vdd_dep_on_sclk->count drives Sclk_voltageOffset overflow
Verdict
INCONCLUSIVE (hardware-gated latent bug, not triggerable on this guest).
The overflow is confirmed real by source tracing; not reachable on the audit
QEMU guest because the sink lives in the loadable amdgpu.ko module and runs
only on AMD Tonga hardware (with clock-stretching enabled) driven by a
(crafted/buggy) VBIOS (absent). fix.diff authored and validated to apply +
compile (nativekernel rc=0, -Werror).
Mechanism (source trace)
tonga_populate_clock_stretcher_data_table
(sys/dev/drm/amd/powerplay/smumgr/tonga_smumgr.c:1620):
uint8_t i;
struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table =
table_info->vdd_dep_on_sclk;
...
for (i = 0; i < sclk_table->count; i++) {
...
smu_data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; /* [8] */
}
Array bound:
- Sclk_voltageOffset[8] (smu72_discrete.h:344). Immediately followed in the
struct by ClockStretcherDataTable and CKS_LOOKUPTable, and downstream by
the DpmTable tail / tonga_smumgr.power_tune_defaults pointer.
Count source:
- sclk_table->count = VBIOS ucNumEntries (u8, 1β255; only a != 0 check at
parse, processpptables.c). With count > 8, i >= 8 writes
Sclk_voltageOffset[8..], overflowing into ClockStretcherDataTable,
CKS_LOOKUPTable, and β far enough β the power_tune_defaults pointer that is
later dereferenced. The written value (volt_offset, a derived u8) is partly
attacker/VBIOS-shaped.
Gating:
- The function is reached only when PHM_PlatformCaps_ClockStretcher is set in
the platform caps (a VBIOS-controlled capability).
Reachability on the audit guest
tonga_smumgr.cis module-only (amdgpu.ko), not in the base kernel;amdgpu.konot loaded.- Runs only on AMD Tonga hardware whose VBIOS enables clock stretching. The guest has no AMD GPU. Not triggerable here.
Exploit chain
None β not exercisable on this guest (module-only + no AMD Tonga HW + VBIOS
capability gate). The primitive is an OOB write of a derived byte past
Sclk_voltageOffset[8]; reachable only on real Tonga hardware with a malformed
VBIOS that enables clock stretching.
PoC changes
Authored tonga_sclk_voltage_offset_overflow.c β documentation stub recording
the module-only / VBIOS-driven reachability finding.
Fix validation
fix.diffapplies cleanly:git apply --check -p1β OK (1 hunk).- Compiles:
make nativekernelrebuiltamdgpu.koβNK_DONE rc=0,tonga_smumgr.cbuilt with-Werror(fix_build.log). - Functional test: not_testable (no AMD Tonga HW).
Recommended fix
Bound the loop by the array size:
for (i = 0; i < sclk_table->count && i < sizeof(...Sclk_voltageOffset)/sizeof(...[0]); i++)
(= 8). See fix.diff.
Fix verification
not_testablecompile validated -Werror
module/kernel build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
β
Verdict
Source-confirmed. tonga sclk_table->count vs Sclk_voltageOffset[8] overflow (clock-stretcher cap). amdgpu not in GENERIC.
No comments yet.