DF-1048 / run.sh
#!/bin/sh # DF-1048 run: executes the arithmetic harness (proves the divide-by-zero # primitive and that the fix eliminates it). On a host with a real MCS7840 # USB-serial adapter attached, also runs the live trigger on /dev/cuaU0. set -e cd "$(dirname "$0")" echo "============================================================" echo " DF-1048: umcs7840_calc_baudrate divide-by-zero (CWE-369)" echo " arithmetic harness (mirrors umcs.c:1056-1070 verbatim)" echo "============================================================" echo echo "[running harness at -O0]" ./harness_O0 echo "RUN_EXIT_O0=$?" echo echo "[running harness at -O2]" ./harness_O2 echo "RUN_EXIT_O2=$?" # Live trigger — only if a real MCS7840 device node exists (it does NOT on # this VM, which has no USB host controller). Optional, non-fatal. if [ -c /dev/cuaU0 ]; then echo echo "[live trigger: /dev/cuaU0 exists — running tcsetattr(B0) PoC]" echo "[expect kernel panic 'Fatal trap 17: divide-by-zero' on unpatched kernel]" ./trigger /dev/cuaU0 || true else echo echo "[live trigger SKIPPED: no /dev/cuaU0 (no USB host controller / MCS7840 in this VM)]" echo "[the arithmetic harness above is the reproducible proof for this environment]" fi |