code wiki / _hdl_build / nx_pkg_gate.nx

nx_pkg_gate.nx

buildroot/runtime/_hdl_build/nx_pkg_gate.nx

27328 B494 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_pkg_gate.nx -- THE GATE FOR THE CONTENT-ADDRESSED PACKAGE LANE (LR3 of /compare/lang). Subject: the DEPLOYED nx_pkg binary (fork-style end-to-end; argv[1] overrides the subject path so a mutation bite can aim at a staged mutant without touching live). Every fixture is assembled AT RUNTIME in /tmp/nx_pkg_gate/ -- nothing is checked in, so a source scanner can never find this gate's own bad inputs, and setup is idempotent so a rerun cannot inherit a prior run's artifacts. WHAT IT PROVES, AND WHY EACH TOOTH EXISTS: A GUARD THAT REFUSES EVERYTHING PASSES EVERY NEGATIVE TEST. So every refusal tooth here is paired with a POSITIVE CONTROL that MUST be allowed, and every refusal asserts WHICH RULE FIRED -- both the rule name on stdout and the distinct exit code. A suite that only asks `was it refused?` is blind by construction, and this estate has already shipped that exact defect once (four SSRF deny tests green while the guard refused every url). ZERO INSTALL-TIME EXECUTION is proven MECHANICALLY, never asserted. The module fixture carries a real would-be install hook, and the gate first RUNS that hook itself to prove it genuinely produces an observable marker (the anti-vacuity control -- otherwise `the marker is absent` proves only that the marker was never producible). The marker is then cleared, the same module resolved through the subject, and the marker asserted ABSENT while the resolve itself SUCCEEDED. NOT ROSTER-ADMITTED BY DEFAULT: it forks the subject ~25 times. Run via nx_job_run or /api/gate_run. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_sha256.nx nx_pkg_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_sha256.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ gv_puts ↻ pg_mkdir sys_mmap ↻ sys_munmap sys_unlinkat sys_mmap ↻ pg_cat pg_write sys_openat_wr sys_write ↻ sys_close pg_write_str pg_write ↻ pg_slen gv_subjects gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap ↻

structs

none

consts

27const PG_SUBJECT_DEFAULT: *u8 = "./nx_pkg.elf" as *u8
28const PG_DIR: *u8 = "/tmp/nx_pkg_gate" as *u8
29const PG_STORE: *u8 = "/tmp/nx_pkg_gate/store" as *u8
30const PG_CONF: *u8 = "/tmp/nx_pkg_gate/pkg_cas.conf" as *u8
31const PG_CONF_BAD: *u8 = "/tmp/nx_pkg_gate/bad_missing_key.conf" as *u8
32const PG_LOCK: *u8 = "/tmp/nx_pkg_gate/pkg.lock" as *u8
33const PG_JRNL: *u8 = "/tmp/nx_pkg_gate/pkgcas.jrnl" as *u8
34const PG_OUT: *u8 = "/tmp/nx_pkg_gate/capture.txt" as *u8
35const PG_MOD_HOOK: *u8 = "/tmp/nx_pkg_gate/mod_with_install_hook.nx" as *u8
36const PG_MOD_SQUAT: *u8 = "/tmp/nx_pkg_gate/mod_typosquat.nx" as *u8
37const PG_PWN_CONF: *u8 = "/tmp/nx_pkg_gate/pwn_conf.conf" as *u8
38const PG_PWN_PAYLOAD: *u8 = "/tmp/nx_pkg_gate/pwn_payload.txt" as *u8
39const PG_PWN_MARKER: *u8 = "/tmp/nx_pkg_gate/PWNED" as *u8
40const PG_PWN_LOCK: *u8 = "/tmp/nx_pkg_gate/pwn.lock" as *u8
41const PG_PWN_STORE: *u8 = "/tmp/nx_pkg_gate/pwnstore" as *u8
42const PG_DEST_OK: *u8 = "/tmp/nx_pkg_gate/resolved_hook.nx" as *u8
43const PG_DEST_GOOD: *u8 = "/tmp/nx_pkg_gate/resolved_pinned.nx" as *u8
44const PG_DEST_SQUAT: *u8 = "/tmp/nx_pkg_gate/resolved_squat.nx" as *u8
45const PG_DEST_MISMATCH: *u8 = "/tmp/nx_pkg_gate/resolved_mismatch.nx" as *u8
46const PG_DEST_OUTSIDE: *u8 = "/etc/nx_pkg_gate_should_never_appear" as *u8
48const PG_NAME_REAL: *u8 = "nx_syscalls" as *u8
49const PG_NAME_SQUAT: *u8 = "nx_sysca11s" as *u8
51const PG_SHAHEX: i64 = 64
52const PG_DIGEST_BYTES: i64 = 32
53const PG_NL: i64 = 10
54const PG_BAR: i64 = 124
55const PG_ASCII_0: i64 = 48
56const PG_ASCII_9: i64 = 57
57const PG_SCRATCH: i64 = 4096
58const PG_MODE_X: i64 = 493
61const PG_EXIT_USAGE: i64 = 3
62const PG_EXIT_CONF: i64 = 4
63const PG_EXIT_MALFORMED: i64 = 5
64const PG_EXIT_ABSENT: i64 = 6
65const PG_EXIT_MISMATCH: i64 = 7
66const PG_EXIT_DEST: i64 = 8
67const PG_EXIT_NOTPINNED: i64 = 9
68const PG_EXIT_PINCONFLICT: i64 = 10
69const PG_EXIT_CHAIN: i64 = 11
70const PG_EXIT_PINAMBIG: i64 = 13

functions

72func pg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
73func pg_mkdir(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_munmap
80func pg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: main calls 2: sys_openat_rdsys_close
81func pg_cat(d: *u8, o: i64, s: *u8) -> i64 { var p: i64 = o; var i: i64 = 0; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
called by 2: pg_saw_rulemain
82func pg_write(path: *u8, buf: *u8, n: i64) -> i64
94func pg_write_str(path: *u8, s: *u8) -> i64 { return pg_write(path, s, pg_slen(s)) }
called by 1: main calls 2: pg_writepg_slen
95func pg_find(hay: *u8, n: i64, needle: *u8) -> i64
called by 3: pg_num_afterpg_saw_rulemain calls 1: pg_slen
108func pg_num_after(hay: *u8, n: i64, key: *u8) -> i64
called by 1: main calls 2: pg_findpg_slen
125func pg_hex_into(dig: *u8, out: *u8) -> i64
called by 1: pg_file_sha
134func pg_file_sha(path: *u8, outhex: *u8) -> i64
146func pg_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, nargs: i64) -> i64
167func pg_read_out(lp: *i64) -> *u8
173func pg_saw_rule(rule: *u8) -> i64
186func main(argc: i64, argv: *i64) -> i64