⬢ DragonFlyBSD Kernel Audit
DF-4064 / fxp_race.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-4064: fxp_stat_timer AB-BA race (fxp_tick blocking lwkt_serialize_enter
# vs fxp_stop's callout_stop under the serializer).
LOG=/root/fxp_race.log
CON=/dev/console
echo "=== fxp race start $(date) ===" > $CON
echo "=== fxp race start $(date) ===" > $LOG
n=0
while [ $n -lt 4 ]; do
  ( while :; do ifconfig fxp0 up 2>/dev/null; ifconfig fxp0 down 2>/dev/null; done ) &
  n=$((n+1))
done
i=0
while [ $i -lt 360 ]; do
  sleep 1
  if ps -axao wchan 2>/dev/null | grep -q costp; then
    echo "=== WEDGE DETECTED t=${i}s (stopper in costp) ===" > $CON
    echo "=== WEDGE DETECTED t=${i}s (stopper in costp) ===" >> $LOG
    ps -axao pid,ppid,stat,wchan,comm > $CON 2>&1
    ps -axao pid,ppid,stat,wchan,comm >> $LOG 2>&1
    echo "=== END WEDGE SNAPSHOT ===" > $CON
    exit 0
  fi
  i=$((i+1))
  if [ $((i % 10)) -eq 0 ]; then echo "...t=${i}s" > $CON; fi
done
echo "=== NO WEDGE in 360s ===" > $CON
echo "=== NO WEDGE in 360s ===" >> $LOG