nx_adversary_suite.nx
buildroot/runtime/nx_adversary_suite.nx
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
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
| 25 | const K_MAGIC_1103515245: i64 = 1103515245 |
| 26 | const K_MAGIC_12345: i64 = 12345 |
| 27 | const K_MAGIC_4096: i64 = 4096 |
| 28 | const K_MAGIC_65536: i64 = 65536 |
| 29 | const K_MAGIC_1247104587: i64 = 1247104587 |
functions
| 31 | func 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 } |
| 32 | func 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 } |
| 34 | func as_lcg(s: i64) -> i64 { return (s * K_MAGIC_1103515245 + K_MAGIC_12345) & 0x7fffffff } |
| 37 | func as_put(b: *u8, off: i64, v: i64, w: i64, le: i64) -> i64 |
| 49 | func as_get(b: *u8, off: i64, w: i64, le: i64) -> i64 called by 1: as_wants |
| 61 | func as_write_file(path: *u8, b: *u8, n: i64) -> i64 |
| 71 | func as_tok(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64 |
| 100 | func as_teq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 113 | func as_tint(buf: *u8, s: i64, e: i64) -> i64 called by 1: as_tn |
| 125 | func as_tcopy(buf: *u8, s: i64, e: i64, pool: *u8, pp: *i64) -> i64 called by 1: as_parse_line |
| 135 | func as_tn(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64 |
| 150 | func as_parse_hdr(spec: *u8, ls: i64, le: i64, g: *i64, se: *i64) -> i64 |
| 177 | func as_parse_line(spec: *u8, ls: i64, le: i64, g: *i64, pool: *u8, pp: *i64) -> i64 |
| 233 | func as_parse(spec: *u8, sn: i64, g: *i64, pool: *u8, pp: *i64) -> i64 |
| 257 | func as_hdr_total(g: *i64) -> i64 |
| 270 | func as_adv(g: *i64, len: i64) -> i64 |
| 277 | func as_total2(g: *i64, clen: *i64, nch: i64) -> i64 |
| 285 | func as_bodyrel2(g: *i64, ctag: *i64, clen: *i64, nch: i64, tag: i64) -> i64 |
| 297 | func as_build2(b: *u8, g: *i64, ctag: *i64, clen: *i64, nch: i64) -> i64 |
| 337 | func as_row(fd: i64, casen: *u8, key: *u8, want: i64) -> i64 |
| 345 | func as_case_rows2(fd: i64, casen: *u8, kind: i64, g: *i64, wv: *i64) -> i64 |
| 366 | func as_manifest2(path: *u8, g: *i64, wvv: *i64, wvz: *i64, tamper: i64) -> i64 |
| 392 | func as_wants(g: *i64, ctag: *i64, clen: *i64, nch: i64, img: *u8, wv: *i64) -> i64 |
| 403 | func main(argc: i64, argv: *i64) -> i64 |