code wiki / (root) / nx_browser_gate.nx

nx_browser_gate.nx

buildroot/runtime/nx_browser_gate.nx

32435 B694 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic browser
docsdependenciesstructsconstsfunctions

about

nx_browser_gate.nx -- THE BROWSER GATE: one command re-proves the Nishi browser claim set, evidence-driven + durable. Data-driven row table (add a row = add a table entry). Each row names a runtime/<module>.nx; the gate builds it through THE SOVEREIGN BUILD LANE (_offc/nx_sov_build_run.elf <mod> --build-only -- nx_cc -> nxasm_x86, no gcc, no binutils), runs the artifact that lane names, and judges via the RAW wait4 status (the sovereign exit-judging law -- never $? through a shell). Rows (the browser claim set, 2026-06-10): arg7-tailcall compiler regression gate: >6-arg tail-call drop (the defect that zeroed every TLS Derive-Secret) tls-kdf RFC 8448 Derive-Secret KATs tls-schedule TLS 1.3 key-schedule KATs jpeg-ascii deterministic synthetic-JPEG decode + raster page-demo live HTTP fetch + html_to_text (example.com:80) own-site-live LIVE sovereign HTTPS fetch of nishifamily.com (TLS 1.3 + real Mozilla CA chain validation) render-own paints the FETCHED page's text -> framebuffer (consumes own-site-live's /tmp/nishi_own.html) recv-hs-probe B1 rung: full encrypted-handshake walk vs example.com (per-record/per-message markers, cert-pipeline verdict + chain sig-alg census); exit 0 = handshake to WAIT_CLIENT_FIN p256-keyshare B4 rung: P-256 ECDH (RFC 5903 KAT both directions, boundary rejects) + dual key_share wire format (x25519 + secp256r1 in one CH) derefcast compiler regression gate: `*p as T` precedence (pre-fix: cast bound inside the deref -> byte- load of the pointer cell -> SIGSEGV; fixed in parse_unary 2026-06-10) p256-loopback B4 server side: OUR server completes a P-256-only client (no HRR), both roles derive byte-identical traffic secrets, off-curve share rejected (the nishifamily P-256 gap, healed + loopback-proven) ch-compat B2 rung, two live legs: httpbin.org census (TLS-1.2-only signature classified -- the CH was never the defect; auto-escalates to a full handshake if they enable 1.3) + github.com

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_browser_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_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_openat_wr bg_open_log sys_openat_append bg_fputs sys_write ↻ bg_fputn sys_mmap ↻ sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real bg_stage_certdata sys_openat_rd bg_cat sys_openat_wr ↻ sys_close sys_mmap ↻ sys_read sys_write ↻ gv_ctr sys_mmap ↻ bg_sov_resolve bg_exists sys_openat_rd ↻

structs

none

consts

92const BG_BUILD_ROWS: i64 = 12 // rows built from runtime/<mod>.nx through the sovereign lane
93const BG_SHOT_ROW: i64 = 12 // index of the browser-shot row (the shipped artifact itself)
94const BG_ROWS: i64 = 13 // every declared row: BG_BUILD_ROWS + the shot row
95const BG_SHOT_ARGV_SLOTS: i64 = 5 // artifact, shot, fixture, png-out, NUL
96const BG_PATH_CAP: i64 = 512 // one resolved path
97const BG_LINE_CAP: i64 = 512 // the builder's last output line, carried onto the row that failed to build
98const BG_NUM_CAP: i64 = 28 // decimal scratch
99const BG_ARGV_SLOTS: i64 = 4 // builder argv: elf, module, --build-only, NUL
100const BG_MODE_644: i64 = 420
101const BG_COPY_CHUNK: i64 = 65536
103const BG_EXIT_SHIFT: i64 = 8
104const BG_EXIT_MASK: i64 = 255
105const BG_SIG_MASK: i64 = 127
106const BG_EXEC_FAIL: i64 = 127 // what bg_run's child exits with when execve itself fails
107const BG_SPACE: i64 = 32
108const BG_TAB: i64 = 9
109const BG_LF: i64 = 10
110const BG_CR: i64 = 13
114const BG_B_OK: i64 = 0
115const BG_B_COMPILE_FAIL: i64 = 1 // the row's source does not compile/assemble -- a row FAIL
116const BG_B_SRC_NOT_FOUND: i64 = 4 // runtime/<mod>.nx absent under both roots -- a row FAIL (the claim set names a source that is gone)
117const BG_B_NO_ARTIFACT: i64 = 5 // the builder exited 0 and named no artifact -- fail loud, never run a fossil
118const BG_B_BUILDER_OTHER: i64 = 10 // any other builder exit (usage etc.) -- a row FAIL with the builder's own last line as the reason
119const BG_B_ADMIT_REFUSED: i64 = 6 // nx_build_admit said no: a fact about the BOX -> NOT RUN
120const BG_B_CANON_REFUSED: i64 = 7 // tree-canon divergence: compiling would prove a FORKED copy -> NOT RUN
121const BG_B_BUILD_TIMEOUT: i64 = 8 // the builder's own deadline fired -> NOT RUN
122const BG_B_BUILDER_EXEC: i64 = 9 // the builder could not be exec'd or died by signal -> NOT RUN
127const BG_SBR_USAGE: i64 = 2
128const BG_SBR_COMPILE_FAIL: i64 = 3
129const BG_SBR_ASM_FAIL: i64 = 4
130const BG_SBR_ADMIT_REFUSED: i64 = 6
131const BG_SBR_CANON_REFUSED: i64 = 7
132const BG_SBR_BUILD_TIMEOUT: i64 = 8

functions

134func bg_puts(s: *u8) -> i64
called by 1: main calls 1: sys_write
141func bg_fputs(fd: i64, s: *u8) -> i64
called by 2: bg_reportmain calls 1: sys_write
148func bg_fputn(fd: i64, v: i64) -> i64
162func bg_putn(v: i64) -> i64 { bg_fputn(1, v); return 0 }
called by 1: main calls 1: bg_fputn
164func bg_cat(dst: *u8, off: i64, s: *u8) -> i64
171func bg_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
184func bg_exists(path: *u8) -> i64
200func bg_sov_resolve() -> *u8
called by 1: main calls 1: bg_exists
213func bg_src_resolve(mod: *u8, out: *u8) -> i64
called by 1: bg_build calls 2: bg_catbg_exists
233func bg_artifact_path(mod: *u8, which: i64, out: *u8) -> i64
243func bg_artifact_resolve(mod: *u8, out: *u8) -> i64
called by 1: bg_build calls 2: bg_artifact_pathbg_exists
266func bg_last_line(path: *u8, out: *u8, cap: i64) -> i64
307func bg_build(mod: *u8, sov: *u8, envp: *i64, logpath: *u8, art: *u8) -> i64
336func bg_report(logfd: i64, name: *u8, build_rc: i64, exit_code: i64, sig: i64, word: *u8, reason: *u8) -> i64
called by 1: main calls 2: bg_fputsbg_fputn
383func bg_stage_certdata(used: *u8) -> i64
410func bg_subject_resolve(argc: i64, argv: *i64, out: *u8) -> i64
called by 1: main calls 2: bg_catbg_exists
430func bg_write_shot_fixture(path: *u8) -> i64
442func bg_open_log() -> i64
called by 1: main calls 1: sys_openat_append
448func main(argc: i64, argv: *i64) -> i64