DragonFlyBSD Kernel Audit
DF-2532 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# Run the DF-2532 harness trigger.
# This loads the harness module (which includes the real xdisk.c) and
# triggers the no-spans + B_FAILONDIS code path via sysctl.
#
# On the UNPATCHED xdisk.c (KKASSERT at line 1009 present):
#   -> panic: assertion "tag->bio == NULL" failed in xa_done at xdisk.c:1009
#
# On the PATCHED xdisk.c (KKASSERT removed by fix.diff):
#   -> no panic; xa_done runs cleanly; xa_release would handle tag->bio
#
# Usage: ./run.sh [unpatched|patched]
set -e

# Unload standalone xdisk if loaded
kldunload xdisk 2>/dev/null || true

# Load the harness module (includes xdisk.c + trigger sysctl)
kldload ./df2532_harness.ko

# Trigger the bug: write 1 to the sysctl
echo "Triggering DF-2532..."
sysctl -w debug.df2532_trigger=1

# Check result
sleep 2
echo "If you see this, the guest survived (fix applied or INVARIANTS off)."