DragonFlyBSD Kernel Audit
DF-0002 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0002 — run the reproduction.
# Must run on the DragonFlyBSD guest as root.
# Expected on a buggy kernel:
#     fhopen returned 0 (success)
#     BUG: fd 0 is stdin, no real descriptor was allocated
# Expected on a fixed kernel:
#     fhopen failed as expected: Invalid argument (errno=22)
set -e
cd "$(dirname "$0")"

# Load the trigger KLD (no-op if already loaded).
kldstat -n df0002_trigger 2>/dev/null || kldload ./df0002_trigger.ko

# Run the PoC.
./fhopen_spur