#!/bin/sh
# DF-2953 -- run in guest as root.
# Stops syslogd (must not hold /dev/klog), raises the logtimeout sampling
# rate, then runs the race hammer for 300s.  On a vulnerable kernel this
# panics within ~1s (Fatal trap 12 in pgsigio, softclock ctx); on a kernel
# with the validated fix.diff it runs to the timeout with no panic.
#
# NOTE: kern.log_wakeups_per_second must be >= 1 (0 would be DF-0191's
# divide-by-zero, a different bug).
set -e
/etc/rc.d/syslogd stop >/dev/null 2>&1 || true
sysctl -w kern.log_wakeups_per_second=100 >/dev/null
timeout 300 /root/klog_sigio_race
