⬢ DragonFlyBSD Kernel Audit
DF-4536 / run.log
← back to finding ↓ download raw
=== DF-4536 race attempts (guest boot #1, root) ===
$ ./lpt_openrace /dev/lpt0 300 350        # same-vnode full path (pre-fd-hold binary)
[*] racing open("/dev/lpt0") x2, 300 rounds, gate every 350 ms
[*] done: 300 rounds, 0 double-open hits
EXIT=0
vmstat -m lpt: Count 0, Requests 604 (no leak, no corruption)

$ ./lpt_openrace /dev/lpt0 /dev/lpt0.ctl 300 450    # different cdevs/vnodes
[*] racing open("/dev/lpt0") vs open("/dev/lpt0.ctl"), 300 rounds ...
[*] done: 300 rounds, 0 double-open hits
EXIT=0

$ mount -t devfs devfs /mnt/df2
$ ./lpt_openrace /dev/lpt0.ctl /mnt/df2/lpt0.ctl 30000 3 25000   # two mounts
[*] racing open("/dev/lpt0.ctl") vs open("/mnt/df2/lpt0.ctl"), 30000 rounds, gate every 3 ms
(timeout 90; ~3600 effective attempts)  -> 0 hits

Earlier CALIBRATION run WITHOUT the fd-hold (same vnode .ctl x .ctl):
[*] racing open("/dev/lpt0.ctl") x2, 20000 rounds, gate every 2 ms
[+] HIT at round 2 / 13 / 14 / 16 / 25 / 30 / 31 / 40 / 50 / 53 / 57 ...
--> FALSE positives: sibling opens AFTER the holder's close (state
cleared), i.e. sequential pairs.  Fixed by holding each fd (usleep)
before close; post-fix runs above show 0 hits across all
configurations.  Root cause of true prevention: mplock (see VERDICT).