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

vinum_scandisk() early returns (ENOENT / longjmp) leave VF_READING_CONFIG set and leak drivelist β€” daemon config saves silently wedged

Summary

The flag and allocation happen before both early exits which skip the only cleanup (at the function tail). The stuck flag makes the daemon refuse every saveconfig - all subsequent configuration changes silently never persisted until some finish_config runs; drivelist leaks per call. REPRODUCED on guest with a bare-ioctl trigger (saveconfig md5 frozen after the wedge; CLI create resumes saving); patched module validated. Free+flag-clear-on-early-returns fix.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-4594 Β· 7 files
FileTypeDescriptionSize
stick.c β€” 1.9 KB view raw
run.sh β€” 151 B view raw
run.log β€” 4.1 KB view raw
run.patched.log β€” 4.2 KB view raw
fix.diff β€” 650 B view raw
build.sh β€” 100 B view raw
env.txt β€” 291 B view raw

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

Patched module: after the identical stick trigger, vinum saveconfig again updates the drive header (md5 changes), i.e. persistence is no longer wedged; no other behavior change observed.

run.patched.log 'DF-4594 evidence': post-stick save cae4f0c8f15581482ef848d905a31c25 -> 861d727dc568436abc2e6ea21af1b063
↓ fix.diffper-fix-DF-4594

Confirmed kernel references

Detail

Evidence (decisive lines)

run.log 'DF-4594 evidence': control save 8898f0fc.. -> a7f08ec2.. then post-stick a7f08ec2.. -> a7f08ec2.. (identical); run.patched.log: post-stick cae4f0c8.. -> 861d727d.. (changed); stick.c is the 30-line bare-ioctl trigger

PoC changes

No seed PoC. Had to fix two guest-reality details: the ioctl magic letter is 'F' (vinumio.h:39), and the non-debug superdev is /dev/vinum/control ('Control' is WRONGSUPERDEV and open() fails ENODEV).

Verified recommended fix

Free drivelist and clear VF_READING_CONFIG on both early returns of vinum_scandisk() (see fix.diff).

Verdict

Reproduced: after a bare VINUM_CREATE ioctl carrying 'read /dev/vn1' (scandisk ENOENT early return at vinumio.c:752), vinum saveconfig leaves the drive header byte-identical -- the daemon's save gate (vinumdaemon.c:126) sees VF_READING_CONFIG stuck set, so all config persistence is silently suppressed until a finish_config runs; drivelist is also leaked. Trigger is root-only (or the vinum.drives loader tunable at boot), hence Low severity despite reliable reproduction. Fix (Free + flag clear on both early returns) validated in the patched module: post-stick saves resume changing the header.