DF-0822 / build.sh
#!/bin/sh # DF-0822 build script — builds both the image-forge tool and the kernel-module harness. # Run on the DragonFly guest as root (the harness is a kld module). set -e cd "$(dirname "$0")" echo "=== building forge (image crafter) ===" cc -O2 -o forge forge.c echo "forge built: $(ls -l forge)" echo "=== building h2adj.ko (kernel-module harness) ===" # The harness calls the REAL hammer2_freemap_adjust() with attacker-controlled radix. mkdir -p /tmp/h2adj_build cp h2adj.c /tmp/h2adj_build/ cp Makefile.h2adj /tmp/h2adj_build/Makefile cp /usr/src/sys/vfs/hammer2/*.h /tmp/h2adj_build/ 2>/dev/null || true cp -r /usr/src/sys/vfs/hammer2/xxhash /tmp/h2adj_build/ 2>/dev/null || true ( cd /tmp/h2adj_build && make ) cp /tmp/h2adj_build/h2adj.ko . echo "h2adj.ko built: $(ls -l h2adj.ko)" |