#!/bin/sh
# DF-0850 PoC run: mount crafted ext2 image and trigger htree lookup
# Must be run as root on the DragonFlyBSD guest.
set -e
IMG="${1:-/root/evil_ext2.img}"
MNT=/mnt/df0850

kldload ext2fs 2>/dev/null || true
vnconfig vn0 "$IMG"
mkdir -p "$MNT"
mount -t ext2fs -o ro /dev/vn0 "$MNT"

echo "Triggering htree lookup..."
stat "$MNT/testdir/f0000_longname_to_force_htree_index_split" 2>&1
echo "RC=$?"

# If we get here, the kernel didn't panic (fix is working)
echo "PoC complete — guest survived."
