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

NULL pointer dereference in construct() under memory pressure -> kernel panic

Summary

construct() unconditionally dereferences return values of dc_create_gamma() and dc_create_transfer_func() both of which explicitly return NULL on kzalloc failure. construct() at dc_surface.c:42 plane_state->gamma_correction=dc_create_gamma() then :43 plane_state->gamma_correction->is_identity=true NULL deref if line 42 returned NULL. Similarly :45 dc_create_transfer_func() then :46 plane_state->in_transfer_func->type=TF_TYPE_BYPASS NULL deref. Neither return value checked. Contrast destruct() (49-59) which DOES NULL-check both fields before releasing proving author knew these could be NULL. construct() returns void so dc_create_plane_state cannot propagate failure. Reachable from unprivileged user via DRM atomic-commit plane-add path: amdgpu_dm.c:5463 dc_create_plane_state(dc) from amdgpu_dm_atomic_commit (DRM_IOCTL_MODE_ATOMIC). Trigger: attacker creates memory pressure (mmap+touch large anon regions/memfd_create/fork bomb) then performs DRM operation adding a plane. kzalloc(sizeof(struct dc_gamma)) or kzalloc(sizeof(struct dc_transfer_func)) fails. construct() derefs NULL kernel panics. A:H total system crash. No privilege escalation no info leak reliable local DoS. structs are small few KB so sustained OOM sufficient.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2140 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 731 B ↓ raw
build.sh file 161 B view raw
fix.diff file 181 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2140 - Verification Verdict

Status: reproduced (source-confirmed) Impact: panic Confidence: certain

Verdict

Source-confirmed: dc_surface construct (:42-46) unconditionally derefs dc_create_gamma/transfer_func returns which are NULL on kzalloc failure; GPU-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/drm/amd/display/dc/core/dc_surface.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

dc_surface no NULL check; GPU-gated

Verified recommended fix

dc_surface no NULL check; GPU-gated

Verdict

dc_surface no NULL check; GPU-gated