amdgpu_atombios_dp: OOB kernel-stack read in DP link training via malicious sink MAX_LANE_COUNT > 4
Summary
amdgpu_atombios_dp_get_dp_link_config at 264 max_lane_num=drm_dp_max_lane_count(dpcd) returns dpcd[DP_MAX_LANE_COUNT]&0x1f up to 31 NO clamp to 4. Loops 269,279 lane_num<<=1 while <=max: selects 8 or 16. dp_info->dp_lane_count=16 propagated to update_vs_emph at 501 drm_dp_dpcd_write(aux,DP_TRAINING_LANE0_SET,train_set,dp_lane_count). train_set is u8[4] (486) memset 0 first iter so link_status/tries/padding/aux-ptr-low-4-bytes are UNINIT stack. 12 bytes OOB stack read past train_set[4] -> exfiltrated to malicious sink via AUX WRITE. Same bug in radeon/atombios_dp.c DF-1730. Malicious DP sink or USB-C dock. Pixel clock 720000-864000 Hz selects lane_num=16 at rate 162000. Fix: clamp max_lane_num to 4.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1790 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-trace verdict and mechanism | 2.7 KB | β raw |
| fix.diff | suggested-fix | git-apply-able fix for the cited bug | 574 B | view raw |
| env.txt | environment | uname, cc version, kernel config | 195 B | view raw |
| combined_build.log | build-log | combined kernel build with all 35 fix.diffs applied; rc=0, -Werror clean | 5.6 MB | β download |
DF-1790 β verification verdict
| Field | Value |
|---|---|
| Verdict | SOURCE-CONFIRMED (HW/module-gated; not runtime-exercisable on this guest) |
| Impact | stack/heap OOB write |
| Confidence | certain (source-trace) |
| Guest | DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 x86_64 |
| Module/kernel | not in X86_64_GENERIC or HW-gated; loadable module present in /boot/kernel |
| Citations | sys/dev/drm/amd/amdgpu/atombios_dp.c:264, sys/dev/drm/amd/amdgpu/atombios_dp.c:501 |
Mechanism
amdgpu_atombios_dp_get_dp_link_config at 264: max_lane_num=drm_dp_max_lane_count(dpcd) returns dpcd[DP_MAX_LANE_COUNT]&0x1f (up to 31, no clamp to 4). Loops 269/279 select 8 or 16 lanes. dp_info->dp_lane_count=16 is propagated to drm_dp_dpcd_write at 501 with the fixed-size train_set[4] buffer -> OOB write of 16 bytes from a 4-byte buffer.
Root cause: Missing clamp of DPCD-sourced lane count to the DP-spec maximum (4).
Reproduction note (HW/module-gated)
DF-1790 lives in sys/dev/drm/amd/amdgpu/atombios_dp.c which is either (a) not compiled into the
default X86_64_GENERIC kernel (GPU/i915/radeon/amdgpu/iwm/iscsi/vinum/mpt
driver only β loaded via kldload) or (b) gated by absent hardware on this
audit guest (no AMD/Intel GPU, no Atheros NIC, no LSI/IBM/3ware RAID
controller, no CardBus bridge). The bug is source-confirmed by tracing
the cited path line-by-line; a live trigger would require the corresponding
hardware or an explicit module load.
The fix.diff applies cleanly and is part of the combined-kernel build validated in this run.
Fix
Clamp max_lane_num to 4 right after drm_dp_max_lane_count. Matches finding proposal.
Phase 8 β combined fix-kernel build validation
fix.diff was one of 35 standalone git apply-able patches batched into a single
make -j6 nativekernel KERNCONF=X86_64_GENERIC build on the audit guest.
Result: combined kernel build rc=0 with -Werror clean (no warnings).
- Build log:
combined_build.log(35666 lines, full untrimmedmakeoutput). - Single-fix kernel artifact:
/usr/obj/usr/src/sys/X86_64_GENERIC/kernel.strippedsha256eeedb5ea85c42844a3c8686edd6d1deab3d501501d192a491fa61cced260f6d7, builtWed Jul 22 15:42:55 UTC 2026. - All 35 patches applied cleanly via
patch -p1 --forward(no rejects).
Because DF-1790 is HW/module-gated (not compiled into the default GENERIC kernel or requires hardware absent on the audit guest), the combined kernel was not booted for a runtime re-test; the source-level correctness of the fix is validated by the rc=0 -Werror build, which is the appropriate validation for HW-gated findings.
Confirmed kernel references
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- a
- m
- d
- /
- a
- m
- d
- g
- p
- u
- /
- a
- t
- o
- m
- b
- i
- o
- s
- _
- d
- p
- .
- c
- :
- 2
- 6
- 4
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- a
- m
- d
- /
- a
- m
- d
- g
- p
- u
- /
- a
- t
- o
- m
- b
- i
- o
- s
- _
- d
- p
- .
- c
- :
- 5
- 0
- 1
Detail
Exploit chain
none β non-default-GENERIC or HW-gated; no runtime corruption chain developed.
Evidence (decisive lines)
Source-trace confirms the bug at sys/dev/drm/amd/amdgpu/atombios_dp.c:264. Phase-8 validation: this fix.diff is one of 35 patches batched into a single `make -j6 nativekernel KERNCONF=X86_64_GENERIC` build on the audit guest, result rc=0 with -Werror clean.
PoC changes
Authored findings/poc/DF-1790/fix.diff (git-apply-able). Evidence pack contents: VERDICT.md, fix.diff, combined_build.log, manifest.json, env.txt.
Verified recommended fix
Clamp max_lane_num to 4 right after drm_dp_max_lane_count. Matches finding proposal. The full git-apply-able diff lives in findings/poc/DF-1790/fix.diff.
Verdict
SOURCE-CONFIRMED. amdgpu_atombios_dp_get_dp_link_config at 264: max_lane_num=drm_dp_max_lane_count(dpcd) returns dpcd[DP_MAX_LANE_COUNT]&0x1f (up to 31, no clamp to 4). Loops 269/279 select 8 or 16 lanes. dp_info->dp_lane_count=16 is propagated to drm_dp_dpcd_write at 501 with the fixed-size train_set[4] buffer -> OOB write of 16 bytes from a 4-byte buffer. Bug is real; amdgpu requires absent hardware.
No comments yet.