code wiki / (root) / nx_boundscheck_gate.nx

nx_boundscheck_gate.nx

buildroot/runtime/nx_boundscheck_gate.nx

11939 B255 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_boundscheck_gate.nx -- GATE for LN3 raw-pointer provenance (lang.plan rung LN3, symbol bck_ptr_provenance). The rung's done-rule: the 2026-07-08 READ-TO-NUL over-read class TRAPS under the --ptrprov declared mode, in-range programs stay accepted, the write leg (CWE-787) traps too, and a provably-out-of-range CONSTANT index is refused at compile time naming the provenance rule. Subjects: the toolchain compiler (argv[1], default the live builder) + runtime/nx_boundscheck.nx + runtime/nx_boundscheck_constidx.nx. ARTIFACT PLACEMENT follows nx_cc_equiv_gate's measured convention: .s and stderr captures in /tmp/nxbchk/ (data), but every ELF THAT MUST RUN lives under _build/ -- the NAS mounts /tmp noexec (measured 2026-08-19: 0755 binary, execve EACCES 126), so a gate that stages runnables in /tmp passes its compile teeth and fails every run tooth with no diagnostic. Names carry the gate's own pid, because two concurrent runs racing one rename source is a documented incident class in the incumbent (its line ~87). Every A/B pair runs through ONE build helper and ONE runner (no second ruler). Exit carries the verdict via gv_verdict (D001). Phase exit codes are PRINTED before the teeth -- a FAIL-only tooth cannot say why, and that blindness cost this gate's first NAS run its diagnosis (the noexec above was found by hand-running the leftover binary). Usage: nx_boundscheck_gate [compiler_elf] (CWD = the tree root, like nx_cc_equiv_gate) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_boundscheck_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_rd sys_close sys_chdir sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir bg_path sys_mmap ↻ sys_mmap ↻ gv_ctr sys_mmap ↻ gv_head gv_puts sys_write ↻ bg_build sys_mmap ↻ sys_openat_wr bg_run sys_fork sys_dup3 sys_mmap ↻ sys_execve sys_exit ↻ sys_wait4 sys_close ↻ sys_renameat

structs

none

consts

25const BG_TRAP: i64 = 71 // NX_TRAP_BOUNDS -- the injected trap's exit_group code

functions

28func bg_run(path: *u8, argv: *i64, redir_out: i64, redir_err: i64) -> i64
44func bg_path(dst: *u8, pfx: *u8, pid: i64, sfx: *u8) -> *u8
called by 1: main calls 1: sys_mmap
64func bg_build(cc: *u8, mode: i64, src: *u8, s_tmp: *u8, elf_out: *u8, err_out: *u8, asm_tmp: *u8) -> i64
90func bg_phase(elf: *u8, phase: *u8) -> i64
called by 1: main calls 3: sys_mmapbg_runwait_status_rc
101func bg_file_has(path: *u8, needle: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
133func bg_val(name: *u8, v: i64) -> i64
called by 1: main calls 2: gv_putsgv_num
142func main(argc: i64, argv: *i64) -> i64