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

dce110_apply_ctx_to_hw error return leaves VBIOS scratch critical-state latched

Summary

The function sets the VBIOS scratch critical state at entry; when apply_single_controller_ctx_to_hw fails the early return skips the clear, leaving the firmware-side bit stuck until the next successful commit. Requires faulty VBIOS/clock programming to reach; no memory-safety impact; error-path hygiene. Clear-before-error-return fix.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3947 Β· 3 files
FileTypeDescriptionSize
README.md doc finding + fix 1.5 KB ↓ raw
VERDICT.md verdict skip rationale 1.0 KB ↓ raw
fix.diff suggested-fix clear critical state on error return 461 B view raw
README.md doc finding + fix
↓ download raw

DF-3947 β€” dce110_apply_ctx_to_hw(): error return leaves VBIOS scratch "critical state" latched

Severity: Info (error-path hygiene; requires faulty BIOS/HW to reach) CWE-459 / missing cleanup on error path

Bug

sys/dev/drm/amd/display/dc/dce110/dce110_hw_sequencer.c:2010-2090:

    dcb->funcs->set_scratch_critical_state(dcb, true);   /* :2028 */
    ...
        status = apply_single_controller_ctx_to_hw(...);  /* :2073 */
        if (DC_OK != status) {
            return status;                           /* :2080 β€” early out */
        }
    }
    dcb->funcs->set_scratch_critical_state(dcb, false);  /* :2084 β€” skipped */

apply_single_controller_ctx_to_hw() fails (returns DC_ERROR_UNEXPECTED) whenever program_pix_clk fails (dce110_hw_sequencer.c:1324-1330) or bios_parser_crtc_source_select fails (:1399-1403) β€” i.e. faulty VBIOS tables or failing clock programming. The early return at :2080 leaves the VBIOS scratch "critical state" bit set; the driver never clears it on this path. The stuck bit tells VBIOS/SMU that display config is mid-transition, which can misdirect firmware-side power-management/event handling until the next successful commit. Also skips enable_fbc (:2086-2087) β€” cosmetic.

No memory-safety impact; the fix is the standard goto-out cleanup.

Fix

        if (DC_OK != status) {
+           dcb->funcs->set_scratch_critical_state(dcb, false);
            return status;
        }

Not PoC-verified (needs DCE-class AMD hardware and an induced BIOS failure); source-certain. No evidence pack beyond this README/manifest/verdict.

VERDICT.md verdict skip rationale
↓ download raw

DF-3947 β€” Verification Verdict

Status: untested (Info-severity error-path finding; verification skipped per policy β€” hardware+BIOS-failure gated, no security impact beyond hygiene) Impact: none demonstrated Confidence: certain (source)

Source: set at dce110_hw_sequencer.c:2028, cleared only at :2084; the error return at :2079-2081 (if (DC_OK != status) return status;) bypasses it. Failure sources: dce110_hw_sequencer.c:1324-1330 (program_pix_clk false) and :1399-1403 (crtc_source_select != BP_RESULT_OK).

No runtime test performed (no AMD GPU on the audit guest). fix.diff is the one-line cleanup; kernel rebuild not warranted for an Info finding.

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean

not_testable: Info finding, hardware/BIOS-gated trigger

fix.diff one-line cleanup
↓ fix.diffper-fix-DF-3947

Confirmed kernel references

Detail

Evidence (decisive lines)

README.md with cited lines; fix.diff one-liner

PoC changes

n/a (no seed)

Verified recommended fix

Clear set_scratch_critical_state(false) before the error return at :2080.

Verdict

Info error-path hygiene: dce110_apply_ctx_to_hw sets VBIOS scratch critical state at :2028 and the error return at :2079-2081 skips the clear at :2084 when apply_single_controller_ctx_to_hw fails (program_pix_clk :1324-1330 or crtc_source_select :1399-1403). Stuck critical-state bit until next successful commit; no memory-safety impact. Verification skipped per policy (Info, hardware+BIOS-failure gated).