DragonFlyBSD Kernel Audit
DF-2633 / run_df2633.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2633 run driver (stock kernel): dedicated 256MB hammer2 image, fill to
# exhaustion with the recording writer, then umount+remount and quantify
# what survived.  Console flood counted from the serial log afterwards.
set -e
cd /root/df2633
cc -O2 -o write2633 write2633.c

truncate -s 256M /tmp/h33.img
vnconfig -c -S 256m -T vn1 /tmp/h33.img
newfs_hammer2 -L DATA /dev/vn1 >/dev/null
mkdir -p /mnt/h33
mount_hammer2 /dev/vn1@DATA /mnt/h33
mkdir -p /root/df2633/ctrl
df /mnt/h33

echo "=== write2633 filling (this takes minutes) ==="
./write2633 /mnt/h33 /root/df2633/ctrl 6000
echo "=== writer exited rc=$? ==="
sync
df /mnt/h33
echo "=== immediate post-run state ==="
ls -l /mnt/h33 | head -5
ls /mnt/h33 | grep -c '^c[0-9]' || true
stat -f "fill.bin size=%z" /mnt/h33/fill.bin 2>/dev/null || echo "fill.bin gone"
md5 < /mnt/h33/tail.bin 2>/dev/null || echo "tail.bin gone"
md5 < /mnt/h33/mm.bin 2>/dev/null || echo "mm.bin gone"
md5 < /root/df2633/ctrl/tail.control
md5 < /root/df2633/ctrl/mm.control

echo "=== umount + remount ==="
umount /mnt/h33
vnconfig -u vn1
vnconfig -c -S 256m -T vn1 /tmp/h33.img
mount_hammer2 /dev/vn1@DATA /mnt/h33
echo "=== post-remount state ==="
df /mnt/h33
ls -l /mnt/h33 | head -5
ls /mnt/h33 | grep -c '^c[0-9]' || true
stat -f "fill.bin size=%z" /mnt/h33/fill.bin 2>/dev/null || echo "fill.bin gone"
echo "fill.bin md5 (first 1MB):"
dd if=/mnt/h33/fill.bin bs=1m count=1 2>/dev/null | md5
md5 < /mnt/h33/tail.bin 2>/dev/null || echo "tail.bin gone"
md5 < /mnt/h33/mm.bin 2>/dev/null || echo "mm.bin gone"
umount /mnt/h33
vnconfig -u vn1
echo "RUN2633_COMPLETE"