# VERDICT — DF-1555: drm_atomic_uapi vblank_event memory leak via stubbed sync_file_create

## Verdict

**INCONCLUSIVE (HW/module gated) — source-level confirmed, fix validated.**

The bug is real and present in master DEV source at `sys/dev/drm/drm_atomic_uapi.c:1083-1090,1108-1133,1055,1213`, but
the affected driver attaches only to hardware not present in the audit QEMU
guest (only virtio+PIIX3 PCI devices, no AMD/Intel GPUs, no ath NICs, no
AdvanSys SCSI, no mfi/tws/mrsas RAID, etc.), so it cannot be live-triggered
here. The `fix.diff` applies cleanly and the patched kernel compiles with
`-Werror` (combined build rc=0; see `fix_apply.log`).

## Mechanism (cited path → primitive → effect)

prepare_signaling allocates drm_pending_vblank_event on OUT_FENCE_PTR crtc prop (even without PAGE_FLIP_EVENT flag). setup_out_fence calls sync_file_create at 1055; on DFly this is a STUB (sync_file.h:48-53) returning NULL -> setup_out_fence returns -ENOMEM at 1057. crtc_state->event->base.fence = fence at 1132 NEVER reached. complete_signaling at 1213 cleanup predicate event && (event->base.fence || event->base.file_priv) -- both NULL -- skips -> event leaked.

## Reachability on this guest

No — `sys/dev/drm/drm_atomic_uapi.c:1083-1090` is in a driver/module that only attaches
to hardware absent from the audit guest. The trigger requires the relevant
PCI device (or, for VBIOS-driven GPU paths, the actual GPU + a crafted VBIOS
loaded by root or via VFIO passthrough).

## Phase 6 — escalation potential

This is a Memory leak primitive. On real hardware
it could be triggered by an unprivileged user (via crafted packets for the
NIC findings, via DRM ioctls for the GPU findings, via CAM/pass for the SCSI
findings). On **this guest** there is no live primitive to convert. Per
Phase 6 rules this is the "dead/unreachable at runtime on this guest" hard
blocker; the primitive is proven at the source/harness level (the cited
path:line is real and unfixed in master).

Realistic impact ceiling on suitable HW: **deterministic kernel memory leak per atomic commit with OUT_FENCE_PTR -> DoS via memory exhaustion**.

## Phase 8 — fix validation

`fix.diff` is a minimal, targeted fix at the root cause confirmed above.

- **Applied cleanly** with `patch -p1 --forward` (verified in `fix_apply.log`).
- **Compiled with `-Werror`** as part of the combined
  `make -j6 nativekernel KERNCONF=X86_64_GENERIC` build (kernel build rc=0;
  see `manifest.json`).
- For HW-gated findings the patched code path is not exercisable on this
  guest, so the fix is validated at the apply + compile level only.

Fix approach: Track event_for_fence_only per crtc iteration; in the setup_out_fence error path, drm_event_cancel_free the event when it was alloc'd solely for the fence path.

## PoC changes

Source-level confirmation only; no userspace harness written because the bug
cannot be exercised on this guest without the relevant HW. The placeholder
`build.sh`/`run.sh` echo pointers to `VERDICT.md` and the module/kernel
rebuild path.
