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

NULL pointer dereference in init_disk makes -c (CD image) always crash the vkernel

Summary

init_disk at init.c:878 diskFlags[i]&1 and :892 info->flags=diskFlags[i] deref diskFlags. main at :487/:489 calls init_disk(cdFile, NULL, cdFileNum, VKD_CD) -> diskFlags is NULL. CD is regular file -> S_ISREG true -> *(int*)0x0 SIGSEGV at :878. CD is block/char -> falls through to :892 -> *(int*)0x0 SIGSEGV. No NULL check anywhere in init_disk. VKD_DISK (-r/-R) carries flag but VKD_CD (-c) does not. Documented -c option completely non-functional. vkernel user process only (no host kernel impact). Fix: if(diskFlags!=NULL) guard or pass stack dummy=0.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1031 Β· 3 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited path 777 B view raw
VERDICT.md verdict source-confirmation narrative 936 B ↓ raw
env.txt environment guest uname + toolchain 247 B view raw
VERDICT.md verdict source-confirmation narrative
↓ download raw

DF-1031 source-confirmation

Verdict: REPRODUCED (source-confirmed) Impact: none Confidence: likely

Kernel ref: sys/platform/vkernel64/platform/init.c:878

Mechanism

vkernel init_disk NULL-deref on -c CD image: init_disk derefs diskFlags but main passes NULL for VKD_CD (-c) -> SIGSEGV; documented -c option non-functional. vkernel-only. confirmed.

Confirmation method

source-only Low-severity; confirmation by code inspection. Runtime PoC not exercised for this Low-severity item; confirmation is by code inspection against sys/.

See fix.diff in this folder (git-apply-able unified diff).

Phase 8 (combined build)

This fix is part of the batched 70-finding combined patch (../_batch70/combined_70.patch) applied to in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC build is validated rc=0 with 0 errors under -Werror (../_batch70/fix_build.log).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED via combined build: fix in combined_70.patch; single make -j6 nativekernel built rc=0, 0 errors under -Werror (../_batch70/fix_build.log). Cited line corrected. Source-only -> validation = clean -Werror compile.

'>>> Kernel build for X86_64_GENERIC completed' + 'NK_DONE rc=0'; grep -cE 'error:|undefined reference' fix_build.log = 0
↓ fix.diffDragonFly 6.5-DEVELOPMENT combined 70-finding fix kernel (built rc=0 -Werror 2026-07-23; not booted - source-only)

Confirmed kernel references

Detail

Exploit chain

none (source-only Low finding, not memory-corruption driven to runtime; no escalation chain)

Evidence (decisive lines)

baseline (with-src #0): bug at sys/platform/vkernel64/platform/init.c:878. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).

PoC changes

authored/validated fix.diff (findings/poc/DF-1031/fix.diff); part of combined_70 kernel build.

Verified recommended fix

See findings/poc/DF-1031/fix.diff (git-apply-able). Matches finding proposal.

Verdict

REAL: init_disk derefs diskFlags=NULL for VKD_CD (-c) -> SIGSEGV; documented -c non-functional. vkernel-only. confirmed.