DragonFlyBSD Kernel Audit
DF-0788 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# run.sh - Run the DF-0788 harness (deterministic OOB-read proof).
#
# Demonstrates the bug: the resident-attribute memcpy reads past the record
# buffer when a_dataoff is unvalidated.  The buggy path faults (SIGSEGV) on
# the guard page; the fixed path rejects the malformed attribute.
cd "$(dirname "$0")"

echo "=== DF-0788 harness: resident attribute data-offset OOB read ==="
echo ""
echo "--- clean case (valid a_dataoff): should succeed (rc=0) ---"
./harness clean; echo "harness_exit=$?"
echo ""
echo "--- oob_dataoff case (lying a_dataoff, BUGGY): should SIGSEGV (rc=2) ---"
./harness oob_dataoff; echo "harness_exit=$?"
echo ""
echo "--- oob_dataoff WITH apply_fix: should reject EINVAL (rc=0) ---"
./harness oob_dataoff apply_fix; echo "harness_exit=$?"