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

Unbounded per-CRTC plane count can overflow MAX_SURFACES stack/heap buffers

Summary

commit_planes_to_stream (:4496 plane_states_constructed[MAX_SURFACES=3]) and dm_determine_update_type_for_commit (:5535 updates/surface[MAX_SURFACES]) use fixed arrays but planes_count/num_plane has no bounds check. Currently masked by hardware: per-CRTC plane count structurally <=2 on all in-tree ASICs. If future DCN exposes >=3 overlay planes per CRTC: stack smash in commit path with attacker-influenced pointer data -> RIP control. Fix: add planes_count<MAX_SURFACES guard.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1154 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1154 635 B ↓ raw
fix.diff suggested-fix Add planes_count<MAX_SURFACES bounds guard before array index 478 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-1154
↓ download raw

DF-1154 Verification Verdict

Severity: Low Impact class: oob_write Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.

Fix: Add planes_count<MAX_SURFACES bounds guard before array index

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): commit_planes_to_stream and dm_determine_update_type_for_commit use fixed arrays plane_states_constructed[MAX_SURFACES=3]/updates[MAX_SURFACES] but planes_count has no bounds

Verified recommended fix

REPRODUCED (source-only): commit_planes_to_stream and dm_determine_update_type_for_commit use fixed arrays plane_states_constructed[MAX_SURFACES=3]/updates[MAX_SURFACES] but planes_count has no bounds check. OOB write.

Verdict

REPRODUCED (source-only): commit_planes_to_stream and dm_determine_update_type_for_commit use fixed arrays plane_states_constructed[MAX_SURFACES=3]/updates[MAX_SURFACES] but planes_count has no bounds check. OOB write.