code wiki / (root) / nx_adversary_suite.nx

nx_adversary_suite.nx

buildroot/runtime/nx_adversary_suite.nx

19330 B497 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_adversary_suite.nx -- the ADVERSARY role's organ (verb: ATTACK -- author the hostile suite). v2 (race-6 rung): the ASSIGNMENT IS A GRAMMAR FILE -- a new race needs a new spec file and ZERO organ recompile (rule 11 carried to its end). The organ reads a container grammar: name <assignment-name> seed <n> deterministic LCG seed (reproducible, never wall-clock) hdr magic4 <packedBE4cc> header field: 4 magic bytes that must match hdr size4 <le> <bias> header field: u32 written as total-bias (RIFF size law) hdr skip <n> header field: n opaque bytes shape <type_w> <len_w> <type_first> <len_le> <pad2> <trail_w> the chunk wire shape count <label> census count key scalar <label> <off> <w> <le> raw header-scalar key (want = read-back from construction) watch <label> <packedtag> one find key per watched chunk type chunk <packedtag> <len> assignment table row (the construction) lane <name> <elfpath> referee lanes, copied verbatim CONSTRUCTS the well-formed image from the table (wants construction-known = the oracle), then applies the fixed perturbation TAXONOMY (the role's knowledge, assignment-independent): WELLFORMED / ZEROLEN (JUNK chunk first, every offset shifts) / TRUNC (cut mid-first-body, scalar zone kept) / GARBAGE (magic destroyed) / OVERLEN (last length inflated past EOF). Writes /tmp/rs_*.bin cases + /tmp/race_manifest.txt + /tmp/rs_manifest_tampered.txt + durable knowledge/status/adversary_suite.log. Usage: nx_adversary_suite [specpath] (default knowledge/specs/race_riff.suite). LAWS: struct-free, integer-only, FLAT ifs (4-deep nested-if miscompile landmine: per-line parser helper resets depth), no &&/||, <=6 args per func. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_adversary_suite.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 as_w sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit as_parse as_parse_line sys_mmap ↻ as_tok as_teq as_tn as_tok ↻ as_tint as_tcopy as_parse_hdr as_tok ↻ as_teq ↻ as_tn ↻ as_build2 as_total2 as_hdr_total as_adv as_put as_lcg as_adv ↻ as_write_file sys_openat_wr sys_write ↻ sys_close ↻ as_wants as_bodyrel2 as_adv ↻ as_get as_hdr_total ↻

structs

none

consts

25const K_MAGIC_1103515245: i64 = 1103515245
26const K_MAGIC_12345: i64 = 12345
27const K_MAGIC_4096: i64 = 4096
28const K_MAGIC_65536: i64 = 65536
29const K_MAGIC_1247104587: i64 = 1247104587

functions

31func as_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd, s, n); return 0 }
called by 3: as_rowas_manifest2main calls 1: sys_write
32func as_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 2: as_rowmain calls 2: sys_mmapsys_write
34func as_lcg(s: i64) -> i64 { return (s * K_MAGIC_1103515245 + K_MAGIC_12345) & 0x7fffffff }
called by 2: as_build2main
37func as_put(b: *u8, off: i64, v: i64, w: i64, le: i64) -> i64
called by 2: as_build2main
49func as_get(b: *u8, off: i64, w: i64, le: i64) -> i64
called by 1: as_wants
61func as_write_file(path: *u8, b: *u8, n: i64) -> i64
71func as_tok(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64
100func as_teq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64
113func as_tint(buf: *u8, s: i64, e: i64) -> i64
called by 1: as_tn
125func as_tcopy(buf: *u8, s: i64, e: i64, pool: *u8, pp: *i64) -> i64
called by 1: as_parse_line
135func as_tn(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64
150func as_parse_hdr(spec: *u8, ls: i64, le: i64, g: *i64, se: *i64) -> i64
called by 1: as_parse_line calls 3: as_tokas_teqas_tn
177func as_parse_line(spec: *u8, ls: i64, le: i64, g: *i64, pool: *u8, pp: *i64) -> i64
233func as_parse(spec: *u8, sn: i64, g: *i64, pool: *u8, pp: *i64) -> i64
called by 1: main calls 1: as_parse_line
257func as_hdr_total(g: *i64) -> i64
called by 2: as_total2main
270func as_adv(g: *i64, len: i64) -> i64
277func as_total2(g: *i64, clen: *i64, nch: i64) -> i64
called by 1: as_build2 calls 2: as_hdr_totalas_adv
285func as_bodyrel2(g: *i64, ctag: *i64, clen: *i64, nch: i64, tag: i64) -> i64
called by 1: as_wants calls 1: as_adv
297func as_build2(b: *u8, g: *i64, ctag: *i64, clen: *i64, nch: i64) -> i64
called by 1: main calls 4: as_total2as_putas_lcgas_adv
337func as_row(fd: i64, casen: *u8, key: *u8, want: i64) -> i64
called by 1: as_case_rows2 calls 2: as_was_wn
345func as_case_rows2(fd: i64, casen: *u8, kind: i64, g: *i64, wv: *i64) -> i64
called by 1: as_manifest2 calls 1: as_row
366func as_manifest2(path: *u8, g: *i64, wvv: *i64, wvz: *i64, tamper: i64) -> i64
392func as_wants(g: *i64, ctag: *i64, clen: *i64, nch: i64, img: *u8, wv: *i64) -> i64
called by 1: main calls 2: as_bodyrel2as_get
403func main(argc: i64, argv: *i64) -> i64