DragonFlyBSD Kernel Audit
DF-0202 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0202 run script: demonstrates msgbuf flood.
set -e
cd "$(dirname "$0")"
N=${1:-5000}

echo "=== before: msgbuf umtx_sleep line count ==="
before=$(sysctl -n kern.msgbuf 2>/dev/null | grep -c umtx_sleep || true)
echo "before_umtx_lines=$before"

echo "=== running umtx_flood $N ==="
./umtx_flood "$N"

echo "=== after: msgbuf umtx_sleep line count ==="
after=$(sysctl -n kern.msgbuf 2>/dev/null | grep -c umtx_sleep || true)
echo "after_umtx_lines=$after"
echo "delta=$((after - before))"

echo "=== last 4 umtx_sleep msgbuf lines (WARNING flood proof) ==="
sysctl -n kern.msgbuf 2>/dev/null | grep umtx_sleep | tail -4