nx_boundscheck.nx
buildroot/runtime/nx_boundscheck.nx
about
nx_boundscheck.nx -- LN3 RAW-POINTER PROVENANCE fixture organ (lang.plan rung LN3, watch
symbol bck_ptr_provenance on /compare/lang row "Raw-pointer access prevented").
WHAT THIS IS. The runnable witness for the compiler's --ptrprov declared mode: a `let`-bound
sys_mmap(<const>) pointer's indexing is bounds-checked like a typed array (nx_parse.nx, the
LN3 block). Each phase is selected by argv so a single trap ends exactly one phase and the
gate (nx_boundscheck_gate) can assert every outcome independently:
nx_boundscheck ok in-range read+write+alias walk -> exit 0 under BOTH modes
(the positive control: a deny mode that refuses everything fails here)
nx_boundscheck read the 2026-07-08 READ-TO-NUL class (CWE-125): a scan with no length
bound walks off a 64-byte allocation. Default build: the over-read
SURVIVES on arena/page slack (exit 0 -- reading bytes that belong to
a NEIGHBORING allocation, the silent-wrong-answer this rung exists to
kill). --ptrprov build: traps exit 71 (NX_TRAP_BOUNDS) at index 64.
nx_boundscheck write CWE-787, the corruption primitive: s[10] on a 10-element allocation.
Default: lands in slack, exit 0. --ptrprov: traps exit 71.
The sibling witness nx_boundscheck_constidx.nx carries the COMPILE-TIME leg (a constant
out-of-range index refused before any binary exists).
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const BCK_ALLOC: i64 = 64 |
| 26 | const BCK_FILL: i64 = 7 |
| 27 | const BCK_W_ELEMS: i64 = 10 |
| 31 | const BCK_W_BYTES: i64 = 80 |
| 84 | const BCK_E_ELEMS: i64 = 64 |
| 85 | const BCK_E_SMALL: i64 = 8 |
| 86 | const BCK_E_PERF_ITERS: i64 = 10000000 |
functions
| 36 | func bck_ptr_provenance() -> i64 |
| 47 | func bck_write_overrun() -> i64 |
| 56 | func bck_inrange_control() -> i64 |
| 94 | func bck_elide_dominated_witness(iters: i64) -> i64 called by 1: main |
| 116 | func bck_elide_perf_witness(reps: i64) -> i64 called by 1: main |
| 141 | func bck_elide_notdominated_witness(n: i64) -> i64 called by 1: main |
| 157 | func bck_elide_keylen_witness(n: i64) -> i64 called by 1: main |
| 171 | func main(argc: i64, argv: *i64) -> i64 |