code wiki / _hdl_build / nx_sup_kernel_witness.nx
nx_sup_kernel_witness.nx
buildroot/runtime/_hdl_build/nx_sup_kernel_witness.nx
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
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
structs
| none |
consts
| 28 | const SW_MAGIC_4096: i64 = 4096 |
| 29 | const SW_MAGIC_8192: i64 = 8192 |
| 30 | const SW_MAGIC_32768: i64 = 32768 |
| 32 | const SW_SNAPCAP: i64 = 65536 |
| 33 | const SW_TCPCAP: i64 = 1048576 |
| 34 | const SW_CMDCAP: i64 = 4096 |
| 35 | const SW_PIDSCAN: i64 = 131072 |
| 36 | const SW_MAXSVC: i64 = 64 |
| 37 | const SW_NEGPORT: i64 = 39999 |
functions
| 50 | func 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 } |
| 51 | func sw_num(v: i64) -> i64 |
| 63 | func sw_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 64 | func sw_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 76 | func sw_find(hay: *u8, hn: i64, ned: *u8, nl: i64) -> i64 called by 1: main |
| 90 | func sw_tcp_scan(path: *u8) -> i64 |
| 137 | func main(argc: i64, argv: *i64) -> i64 |