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

psp_cmd_submit_buf ignores resp.status when ucode==NULL: TMR/ASD firmware-command failures silently reported as success

Summary

The resp.status check is gated on 'ucode &&'; the ucode==NULL callers are exactly TMR/ASD load - a PSP rejection returns 0 and security ucode proceeds loading into a TMR that was never established, with no log. Secure-state correctness issue; drop the guard.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-4768 Β· 4 files
FileTypeDescriptionSize
README.md β€” 1.4 KB ↓ raw
VERDICT.md β€” 1.1 KB ↓ raw
fix.diff β€” 410 B view raw
verdict.json β€” 1.9 KB view raw

DF-4768 β€” psp_cmd_submit_buf ignores resp.status when ucode==NULL: TMR/ASD load failures are reported as success

File: sys/dev/drm/amd/amdgpu/amdgpu_psp.c (pass 2) Info-grade defense-in-depth finding; static (no AMD GPU on audit guest).

Path

psp_cmd_submit_buf() (amdgpu_psp.c:118-150) checks the firmware's response status only when a ucode argument was supplied:

137:  /* the status field must be 0 after FW is loaded */
138:  if (ucode && psp->cmd_buf_mem->resp.status) {
139:      DRM_ERROR("failed loading with status (%d) and ucode id (%d)\n", ...);
141:      return -EINVAL;

The two callers that pass ucode == NULL are psp_tmr_load() (:193, GFX_CMD_ID_SETUP_TMR β€” establishes the Trusted Memory Region) and psp_asd_load() (:260, GFX_CMD_ID_LOAD_ASD). If PSP firmware rejects the TMR setup or ASD load (resp.status != 0), the function still returns ret (the ring-write status, typically 0), so:

  • psp_hw_start() reports success and psp_np_fw_load() proceeds to load all security-sensitive ucode into a TMR the PSP never set up;
  • the failure is silent β€” not even a log line.

Impact is firmware-robustness / security-state confusion (uCode loaded without an established trusted region), not kernel memory corruption; hence Info. No runtime PoC possible on this guest (amdgpu never attaches).

Fix

fix.diff β€” check resp.status unconditionally.

VERDICT.md
↓ download raw

DF-4768 VERDICT

Status: INCONCLUSIVE-RUNTIME / SOURCE-CONFIRMED (no AMD GPU on the audit guest; DF-1854/DF-1855 precedent).

amdgpu_psp.c:137-142 gates the response-status check on ucode != NULL, so psp_tmr_load (:193, index 1) and psp_asd_load (:260, index 2) β€” the two ucode==NULL callers β€” return success even when the PSP reports a nonzero resp.status. psp_hw_start then continues into psp_np_fw_load with no Trusted Memory Region established and no error logged. Kernel memory-safety impact: none (correctness/security-state issue only) β‡’ Info severity, confidence certain on the code, speculative on real-world effect (depends on PSP FW ever rejecting TMR/ASD).

Fix: fix.diff (drop the ucode && guard). Not runtime-validatable on this guest.

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

fix.diff applies cleanly to pristine sys/dev/drm/amd/amdgpu/amdgpu_psp.c; runtime validation needs AMD hardware absent from the guest.

fix.diff (one-token guard removal).
↓ fix.diffper-fix-DF-4768

Confirmed kernel references

Detail

Evidence (decisive lines)

README.md / VERDICT.md (path:line chain); fix.diff.

PoC changes

No runtime PoC possible on this guest; static-only evidence pack.

Verified recommended fix

Check resp.status unconditionally: drop the 'ucode &&' at amdgpu_psp.c:138 (fix.diff).

Verdict

SOURCE-CONFIRMED, INCONCLUSIVE-RUNTIME (no AMD GPU on audit guest). psp_cmd_submit_buf (amdgpu_psp.c:137-142) checks the PSP firmware response status only when ucode!=NULL, so psp_tmr_load (:193, GFX_CMD_ID_SETUP_TMR) and psp_asd_load (:260, GFX_CMD_ID_LOAD_ASD) return the ring-write status even when the firmware rejected the command (resp.status != 0): psp_hw_start reports success and psp_np_fw_load proceeds to load security ucode into a Trusted Memory Region the PSP never established, silently. Correctness/secure-boot-state issue, not kernel memory corruption; Info severity, hardware verification impossible on this guest.