⬢ DragonFlyBSD Kernel Audit
DF-4064 / fxp_race4.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-4064 phase 4: same cycle but a SATURATING M-storm (6 dump loops) so the
# netmsg queue never idles while the tick is parked.
LOG=/root/fxp_race4.log
CON=/dev/console
echo "=== fxp race4 start $(date) ===" > $CON
echo "=== fxp race4 start ===" > $LOG
cyc=0
while [ $cyc -lt 24 ]; do
  cyc=$((cyc+1))
  ifconfig fxp0 up 2>/dev/null
  for j in 1 2 3 4 5 6; do
    ( while :; do ifconfig fxp0 >/dev/null 2>&1; done ) &
    eval MP$j=$!
  done
  sleep 1.2
  ifconfig fxp0 down 2>/dev/null &
  sleep 0.8
  if ps -axao wchan 2>/dev/null | grep -q costp; then
    echo "=== WEDGE DETECTED cycle=$cyc (costp) ===" > $CON
    echo "=== WEDGE DETECTED cycle=$cyc ===" >> $LOG
    ps -axao pid,stat,wchan,comm > $CON 2>&1
    ps -axao pid,stat,wchan,comm >> $LOG 2>&1
    echo "=== END WEDGE SNAPSHOT ===" > $CON
    exit 0
  fi
  kill $MP1 $MP2 $MP3 $MP4 $MP5 $MP6 2>/dev/null
  pkill ifconfig 2>/dev/null
  sleep 0.5
  if [ $((cyc % 4)) -eq 0 ]; then echo "-- cycle $cyc" > $CON; fi
done
echo "=== NO WEDGE in 24 cycles ===" > $CON
echo "=== NO WEDGE in 24 cycles ===" >> $LOG