code wiki / _hdl_build / nx_opaque_login_smoke.nx
nx_opaque_login_smoke.nx
buildroot/runtime/_hdl_build/nx_opaque_login_smoke.nx
about
nx_opaque_login_smoke.nx -- R2 smoke: fork the OPAQUE login daemon, drive it as a REAL HTTP client over a
socket (POST /register -> POST /login -> GET /whoami[valid] -> GET /whoami[bad token]), proving the
no-cookie OPAQUE login works end-to-end over the wire. Requires /tmp/nx_opaque_login_daemon.sov.elf built
in the same WSL session (the WOMB emits there). exit 0 = pass, N = assertion N failed.
TOOTH 5 (2026-08-18, lane F): the daemon must not GROW under load -- SMK_LEAK_N warm GET / requests must
leave its VmSize where the warm-up left it. Bite-proven against the pre-fix binary: every response mapped a
fresh 2 MiB compose buffer, so 100 requests moved VmSize by ~204,800 kB; the tolerance is TWO syscall-arena
chunks (2 x 256 KiB), the only allocation a warm request path may still legitimately cross.
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_connect.nxnx_assert.nxnx_hr_admin.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
| 13 | const SMK_MAGIC_32768: i64 = 32768 |
| 14 | const SMK_MAGIC_2048: i64 = 2048 |
| 15 | const SMK_MAGIC_32767: i64 = 32767 |
| 23 | const SMK_PORT_BASE: i64 = 18099 |
| 24 | const SMK_PORT_SPAN: i64 = 32 |
| 26 | const SMK_LEAK_N: i64 = 100 // requests driven for the growth tooth |
| 27 | const SMK_LEAK_TOL_KB: i64 = 512 // 2 x NXA_CHUNK (256 KiB) -- the arena may roll one chunk under 100 requests |
| 28 | const SMK_BUDGET: *u8 = "200" as *u8 // daemon request budget: 4 protocol requests + warm-up + SMK_LEAK_N, with slack |
| 29 | const SMK_STATBUF: i64 = 4096 |
| 30 | const SMK_READY_TRIES: i64 = 60 |
| 31 | const SMK_READY_MS: i64 = 250 |
| 34 | const DAEMON_ELF: *u8 = "/tmp/nx_opaque_login_daemon.sov.elf" as *u8 |
| 39 | const SMK_HR_PREFIX: *u8 = "/tmp/nx_olgd_smoke_hr" as *u8 // + "-<epoch>-" per run: a fresh, empty store every time |
| 40 | const SMK_REALM: *u8 = "nishi_site_admin" as *u8 |
| 41 | const SMK_REALM_N: i64 = 16 |
| 42 | const SMK_HANDLE: *u8 = "smoke" as *u8 |
| 43 | const SMK_HANDLE_N: i64 = 5 |
functions
| 45 | func smk_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 47 | func smk_pick_port(base: i64, span: i64) -> i64 |
| 64 | func smk_find(buf: *u8, n: i64, needle: *u8, nl: i64) -> i64 |
| 71 | func smk_vmsize_kb(pid: i64, scr: *u8) -> i64 |
| 90 | func smk_trunc(path: *u8) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd>=0 { sys_close(fd) } return 0 } |
| 93 | func smk_http(req: *u8, reqn: i64, resp: *u8, cap: i64) -> i64 called by 1: main calls 7: sys_socketsys_set_socket_timeoutsys_mmapnx_connect_boundedsys_closesys_write+1 |
| 107 | func smk_post(reqbuf: *u8, path: *u8, body: *u8) -> i64 |
| 119 | func main(argc: i64, margv: *i64) -> i64 |