⬢ DragonFlyBSD Kernel Audit
DF-4266 / kld_run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-4266 — run the KLD rig against the REAL kernel handler symbols.
#   baseline: expects "S1 BUG CONFIRMED" (completed frame dropped),
#             "S1fix ... 1 FRAME DELIVERED" (identical state processed
#             by the one-line-fixed comparator), "S2 BUG CONFIRMED"
#             (chip-owned descriptors processed + full ring re-init per
#             dispatch), "S3 BUG CONFIRMED" (frame accepted from an
#             OWN=1 descriptor + re-armed under the chip), SURVIVED.
#   fixed:    run on a kernel built with fix.diff applied: S1 delivers
#             via the REAL handler, S2/S3 break on OWN-set descriptors,
#             no BUG CONFIRMED markers.
# Usage (host): vm.sh run_root 'sh /root/df4266/kld_run.sh [baseline|fixed]'
set -e
cd /root/df4266
MODE="${1:-baseline}"

K=/boot/kernel/kernel
A_RXEOF=$(nm $K | awk '/ t wb_rxeof$/{print $1; exit}')
A_INIT=$(nm $K | awk '/ t wb_init$/{print $1; exit}')
A_STOP=$(nm $K | awk '/ t wb_stop$/{print $1; exit}')
echo "wb_rxeof=0x$A_RXEOF wb_init=0x$A_INIT wb_stop=0x$A_STOP"
test -n "$A_RXEOF" -a -n "$A_INIT" -a -n "$A_STOP"

kldload ./df4266_wb_poc.ko
trap 'kldunload df4266_wb_poc 2>/dev/null || true' EXIT
sysctl -w kern.df4266.rxeof=$A_RXEOF
sysctl -w kern.df4266.init=$A_INIT
sysctl -w kern.df4266.stop=$A_STOP

echo "=== go: mode $MODE (dispatching the running kernel's own wb_rxeof) ==="
sysctl -w kern.df4266.go=1
echo "GO_RC=$?"
echo "=== marker summary ==="
dmesg | grep 'df4266:' | grep -E 'BUG CONFIRMED|S1fix|SURVIVED|UNEXPECTED' || true