DF-1359 / rig_build.sh
#!/bin/sh # DF-1359 pass-3 rig: build the KLD that dispatches the REAL production # mps ioctl handler, plus the unprivileged trigger. # # Run as root on the DragonFly guest (all paths in-guest): # sh rig_build.sh set -e cd "$(dirname "$0")" # kernel module: dispatch rig (makefile is 'rig.Makefile') make -f rig.Makefile SYSDIR=/usr/src/sys MACHINE=x86_64 MACHINE_ARCH=x86_64 # userspace trigger (build for unprivileged use) cc -O -Wall -o trigger df1359rig_trigger.c chmod 755 trigger # load + prime: resolve the REAL handler from the RUNNING kernel binary kldload ./df1359rig.ko ADDR=$(nm /boot/kernel/kernel | awk '/ t mps_ioctl_devsw$/{print $1}') echo "mps_ioctl_devsw = 0x$ADDR" sysctl -w kern.df1359rig_target=0x$ADDR ls -l /dev/df1359rig echo "READY: as an unprivileged operator-group user run:" echo " su operator -c '/root/rig1359/trigger probe'" |