#!/bin/sh
# DF-0796 harness run script.
# Loads the KLD module, which synthesises a hammer2_inode whose cluster has a
# NULL interior chain slot and calls hammer2_inode_chain_and_parent() on it.
#
#   - BUGGY kernel (#0, unpatched): NULL-deref panic at chain->parent;
#     guest dies in DDB (fault VA 0x118).  kldload never returns; ssh dies.
#   - FIXED kernel (#1, with fix.diff): prints "SURVIVED -- chain=0 parent=0",
#     kldload returns 0, guest stays up.
#
# Must be run as root inside the guest.
set -e
cd "$(dirname "$0")"
echo "run.sh: loading df0796_harness.ko on $(sysctl -n kern.version | head -1)"
kldload ./df0796_harness.ko
echo "run.sh: KLDLOAD_RC=$? (0 = guest survived = bug fixed/absent)"
echo "run.sh: harness dmesg:"
dmesg | grep DF-0796 | tail -5
