#!/bin/sh
# DF-1227 run — issues the MPTIOCTL_PASS_THRU PoC if /dev/mpr0 exists.
DEV="${1:-/dev/mpr0}"
if [ ! -e "$DEV" ]; then
  echo "[DF-1227] $DEV does not exist on this guest."
  echo "[DF-1227] mpr(4) is in GENERIC but attaches only to an LSI SAS controller;"
  echo "          pciconf shows none here => no cdev => ioctl unreachable."
  echo "[DF-1227] PoC would trigger the heap overflow on a host with an mpr"
  echo "          controller + an rw-openable /dev/mprN (root or operator)."
  exit 0
fi
if [ ! -x ./mpr_nvme_prp_overflow ]; then
  echo "[DF-1227] PoC not built; run ./build.sh first." >&2
  exit 1
fi
./mpr_nvme_prp_overflow "$DEV"
