code wiki / _hdl_build / nx_sup_kernel_witness.nx

nx_sup_kernel_witness.nx

buildroot/runtime/_hdl_build/nx_sup_kernel_witness.nx

13436 B311 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_sup_kernel_witness.nx -- SECOND-METHOD-CLASS WITNESS for the SUPERVISOR domain (2026-08-03). WHY: nx_sota_status holds 40 domains at MECH-OK -- 'executed evidence GREEN; awaiting a 2nd independent method class' -- and supervisor is the lowest-coverage of them (347). The recipe is proven twice (videocodec/ffmpeg-psnr, coding/library-refetch): find an EXTERNAL artifact that can DISAGREE with us, run both, sign the row. Here the external authority is the LINUX KERNEL'S OWN BOOK-KEEPING -- the /proc process table and the /proc/net/tcp{,6} LISTEN socket table -- an accounting we did not write and cannot wish into agreement. THE CLAIM UNDER TEST: mgmt_snap.json, the snapshot the supervisor itself writes each poll ('SVC <name> <port> UP <procs> ...'). For every service the supervisor claims UP: axis 1 (process table): at least one live pid whose cmdline names the service binary axis 2 (socket table): when port>0, a LISTEN socket on exactly that port PRESENCE, not process-count equality, is asserted DELIBERATELY: sites.elf preforks workers, so the snapshot's procs=1 and the kernel's 5 pids are DIFFERENT UNITS -- comparing counts would manufacture a false disagreement (do the arithmetic in the unit the criterion is written in). DISCRIMINATION IS PROVEN IN-RUN, never assumed: a fabricated service name and a fabricated port are checked the same way and MUST come back absent; if either 'confirms', the run is INVALID -- a witness that cannot refuse cannot confirm. exit 0 = GREEN (every UP claim kernel-confirmed on both axes, negative controls refused) 1 = RED (the kernel DISAGREES with a supervisor claim -- a REAL finding, report it) 2 = snapshot unreadable/empty (cannot witness a claim nobody made) 3 = NEGCTL-INVALID (the instrument cannot refuse -> no verdict, never a pass) license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_sup_kernel_witness.nx

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

main sw_p sys_write sys_mmap sw_read sys_openat_rd sys_read sys_close sys_exit sw_tcp_scan sys_mmap ↻ sw_read ↻ sw_len sw_find sw_num sys_mmap ↻ sys_write ↻

structs

none

consts

28const SW_MAGIC_4096: i64 = 4096
29const SW_MAGIC_8192: i64 = 8192
30const SW_MAGIC_32768: i64 = 32768
32const SW_SNAPCAP: i64 = 65536
33const SW_TCPCAP: i64 = 1048576
34const SW_CMDCAP: i64 = 4096
35const SW_PIDSCAN: i64 = 131072
36const SW_MAXSVC: i64 = 64
37const SW_NEGPORT: i64 = 39999

functions

50func sw_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
51func sw_num(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
63func sw_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
64func sw_read(path: *u8, buf: *u8, cap: i64) -> i64
76func sw_find(hay: *u8, hn: i64, ned: *u8, nl: i64) -> i64
called by 1: main
90func sw_tcp_scan(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsw_read
137func main(argc: i64, argv: *i64) -> i64