DragonFlyBSD Kernel Audit
DF-0008 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0008 — run the vfs_setpublicfs() trigger.  MUST run as root (mount/export
# is privilege-gated).  Issues an UPDATE mount of the given ufs mountpoint
# (default /boot) with MNT_EXPUBLIC|MNT_EXPORTED + ex_indexfile, reaching the
# buggy :2261-vput -> :2269-VOP_PATHCONF(rvp) sequence in vfs_setpublicfs().
#
# Usage: ./run.sh [mountpoint] [loops]
set -u
cd "$(dirname "$0")"
DIR="${1:-/boot}"
LOOPS="${2:-16}"

if [ "$(id -u)" != "0" ]; then
    echo "must run as root (mount/export is privilege-gated)" >&2
    exit 2
fi
if [ ! -x ./expub ]; then
    echo "run ./build.sh first" >&2
    exit 2
fi

./expub "$DIR" "$LOOPS"
rc=$?
echo "--- guest alive check ---"
uptime
echo "run.sh: expub exit=$rc"