nx_adversary_suite.nx source
↩ module page · 497 lines · 19330 B
1// nx_adversary_suite.nx -- the ADVERSARY role's organ (verb: ATTACK -- author the hostile suite).
2// v2 (race-6 rung): the ASSIGNMENT IS A GRAMMAR FILE -- a new race needs a new spec file and
3// ZERO organ recompile (rule 11 carried to its end). The organ reads a container grammar:
4// name <assignment-name>
5// seed <n> deterministic LCG seed (reproducible, never wall-clock)
6// hdr magic4 <packedBE4cc> header field: 4 magic bytes that must match
7// hdr size4 <le> <bias> header field: u32 written as total-bias (RIFF size law)
8// hdr skip <n> header field: n opaque bytes
9// shape <type_w> <len_w> <type_first> <len_le> <pad2> <trail_w> the chunk wire shape
10// count <label> census count key
11// scalar <label> <off> <w> <le> raw header-scalar key (want = read-back from construction)
12// watch <label> <packedtag> one find key per watched chunk type
13// chunk <packedtag> <len> assignment table row (the construction)
14// lane <name> <elfpath> referee lanes, copied verbatim
15// CONSTRUCTS the well-formed image from the table (wants construction-known = the oracle), then
16// applies the fixed perturbation TAXONOMY (the role's knowledge, assignment-independent):
17// WELLFORMED / ZEROLEN (JUNK chunk first, every offset shifts) / TRUNC (cut mid-first-body,
18// scalar zone kept) / GARBAGE (magic destroyed) / OVERLEN (last length inflated past EOF).
19// Writes /tmp/rs_*.bin cases + /tmp/race_manifest.txt + /tmp/rs_manifest_tampered.txt + durable
20// knowledge/status/adversary_suite.log. Usage: nx_adversary_suite [specpath]
21// (default knowledge/specs/race_riff.suite).
22// LAWS: struct-free, integer-only, FLAT ifs (4-deep nested-if miscompile landmine: per-line
23// parser helper resets depth), no &&/||, <=6 args per func. license_tier: ORIGINAL
24import "nx_syscalls.nx"
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
30
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 }
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 }
33
34func as_lcg(s: i64) -> i64 { return (s * K_MAGIC_1103515245 + K_MAGIC_12345) & 0x7fffffff }
35
36// generic field store: le=0 big-endian, le=1 little-endian
37func as_put(b: *u8, off: i64, v: i64, w: i64, le: i64) -> i64 {
38 var i: i64 = 0
39 while i < w {
40 var sh: i64 = i * 8
41 if le == 0 { sh = (w - 1 - i) * 8 }
42 b[off + i] = ((v >> sh) & 0xff) as u8
43 i = i + 1
44 }
45 return 0
46}
47
48// generic field read (the scalar want = read-back from the construction)
49func as_get(b: *u8, off: i64, w: i64, le: i64) -> i64 {
50 var v: i64 = 0
51 var i: i64 = 0
52 while i < w {
53 var sh: i64 = i * 8
54 if le == 0 { sh = (w - 1 - i) * 8 }
55 v = v | ((b[off + i] & 0xff) << sh)
56 i = i + 1
57 }
58 return v
59}
60
61func as_write_file(path: *u8, b: *u8, n: i64) -> i64 {
62 let fd: i64 = sys_openat_wr(path, 0x1a4)
63 if fd < 0 { return 0 - 1 }
64 if n > 0 { sys_write(fd, b, n) }
65 sys_close(fd)
66 return 0
67}
68
69// ---- spec tokenizer (the referee's rh_tok flag pattern -- no sentinel arithmetic) ----
70// token #idx within buf[ls,le), space-separated; writes start/end to se[0]/se[1]; 1=found
71func as_tok(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64 {
72 var i: i64 = ls
73 var cur: i64 = 0
74 var scanning: i64 = 1
75 var ret: i64 = 0
76 while scanning == 1 {
77 var skipping: i64 = 1
78 while skipping == 1 {
79 if i >= le { skipping = 0 }
80 if skipping == 1 { if buf[i] != (32 as u8) { skipping = 0 } }
81 if skipping == 1 { i = i + 1 }
82 }
83 if i >= le { scanning = 0 }
84 if scanning == 1 {
85 var j: i64 = i
86 var walking: i64 = 1
87 while walking == 1 {
88 if j >= le { walking = 0 }
89 if walking == 1 { if buf[j] == (32 as u8) { walking = 0 } }
90 if walking == 1 { j = j + 1 }
91 }
92 if cur == idx { se[0] = i; se[1] = j; ret = 1; scanning = 0 }
93 if scanning == 1 { cur = cur + 1; i = j }
94 }
95 }
96 return ret
97}
98
99// token equals NUL-terminated literal
100func as_teq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64 {
101 var n: i64 = 0
102 while lit[n] != (0 as u8) { n = n + 1 }
103 if e - s != n { return 0 }
104 var i: i64 = 0
105 while i < n {
106 if buf[s + i] != lit[i] { return 0 }
107 i = i + 1
108 }
109 return 1
110}
111
112// decimal token -> int (grammar files carry no negatives)
113func as_tint(buf: *u8, s: i64, e: i64) -> i64 {
114 var v: i64 = 0
115 var i: i64 = s
116 while i < e {
117 let c: i64 = buf[i] as i64
118 if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } }
119 i = i + 1
120 }
121 return v
122}
123
124// copy token into pool as NUL-terminated string; returns ptr, advances pp[0]
125func as_tcopy(buf: *u8, s: i64, e: i64, pool: *u8, pp: *i64) -> i64 {
126 let base: i64 = (pool as i64) + pp[0]
127 var i: i64 = 0
128 while s + i < e { pool[pp[0] + i] = buf[s + i]; i = i + 1 }
129 pool[pp[0] + i] = 0 as u8
130 pp[0] = pp[0] + i + 1
131 return base
132}
133
134// tok #idx -> int (one-call helper keeps line parsers flat)
135func as_tn(buf: *u8, ls: i64, le: i64, idx: i64, se: *i64) -> i64 {
136 if as_tok(buf, ls, le, idx, se) != 1 { return 0 }
137 return as_tint(buf, se[0], se[1])
138}
139
140// ---- the parsed grammar (flat arrays; G_* layout documented per index) ----
141// g[0]=seed g[1]=nhdr g[2..9]=hkind g[10..17]=harg1 g[18..25]=harg2
142// g[26..31]=shape(type_w len_w type_first len_le pad2 trail_w)
143// g[32]=count_label g[33]=have_scalar g[34]=scalar_label g[35]=soff g[36]=sw g[37]=sle
144// g[38]=nwatch g[39..46]=wlabel g[47..54]=wtag
145// g[55]=nch g[56..71]=ctag g[72..87]=clen
146// g[88]=nlane g[89..92]=lane line ptrs (verbatim "name path")
147// g[93]=name_label
148
149// the "hdr" row parser (own func = flat depth)
150func as_parse_hdr(spec: *u8, ls: i64, le: i64, g: *i64, se: *i64) -> i64 {
151 let hi: i64 = g[1]
152 if hi >= 8 { return 0 }
153 if as_tok(spec, ls, le, 1, se) != 1 { return 0 }
154 if as_teq(spec, se[0], se[1], "magic4" as *u8) == 1 {
155 g[2 + hi] = 0
156 g[10 + hi] = as_tn(spec, ls, le, 2, se)
157 g[1] = hi + 1
158 return 1
159 }
160 if as_teq(spec, se[0], se[1], "size4" as *u8) == 1 {
161 g[2 + hi] = 1
162 g[10 + hi] = as_tn(spec, ls, le, 2, se)
163 g[18 + hi] = as_tn(spec, ls, le, 3, se)
164 g[1] = hi + 1
165 return 1
166 }
167 if as_teq(spec, se[0], se[1], "skip" as *u8) == 1 {
168 g[2 + hi] = 2
169 g[10 + hi] = as_tn(spec, ls, le, 2, se)
170 g[1] = hi + 1
171 return 1
172 }
173 return 0
174}
175
176// one grammar line -> g tables (early returns keep every branch shallow)
177func as_parse_line(spec: *u8, ls: i64, le: i64, g: *i64, pool: *u8, pp: *i64) -> i64 {
178 if le <= ls { return 0 }
179 if spec[ls] == (35 as u8) { return 0 }
180 let se: *i64 = sys_mmap(32) as *i64
181 if as_tok(spec, ls, le, 0, se) != 1 { return 0 }
182 let k0s: i64 = se[0]
183 let k0e: i64 = se[1]
184 if as_teq(spec, k0s, k0e, "seed" as *u8) == 1 { g[0] = as_tn(spec, ls, le, 1, se); return 1 }
185 if as_teq(spec, k0s, k0e, "name" as *u8) == 1 {
186 if as_tok(spec, ls, le, 1, se) == 1 { g[93] = as_tcopy(spec, se[0], se[1], pool, pp) }
187 return 1
188 }
189 if as_teq(spec, k0s, k0e, "hdr" as *u8) == 1 { return as_parse_hdr(spec, ls, le, g, se) }
190 if as_teq(spec, k0s, k0e, "shape" as *u8) == 1 {
191 var si: i64 = 0
192 while si < 6 { g[26 + si] = as_tn(spec, ls, le, 1 + si, se); si = si + 1 }
193 return 1
194 }
195 if as_teq(spec, k0s, k0e, "count" as *u8) == 1 {
196 if as_tok(spec, ls, le, 1, se) == 1 { g[32] = as_tcopy(spec, se[0], se[1], pool, pp) }
197 return 1
198 }
199 if as_teq(spec, k0s, k0e, "scalar" as *u8) == 1 {
200 g[33] = 1
201 if as_tok(spec, ls, le, 1, se) == 1 { g[34] = as_tcopy(spec, se[0], se[1], pool, pp) }
202 g[35] = as_tn(spec, ls, le, 2, se)
203 g[36] = as_tn(spec, ls, le, 3, se)
204 g[37] = as_tn(spec, ls, le, 4, se)
205 return 1
206 }
207 if as_teq(spec, k0s, k0e, "watch" as *u8) == 1 {
208 let wi: i64 = g[38]
209 if wi >= 8 { return 0 }
210 if as_tok(spec, ls, le, 1, se) == 1 { g[39 + wi] = as_tcopy(spec, se[0], se[1], pool, pp) }
211 g[47 + wi] = as_tn(spec, ls, le, 2, se)
212 g[38] = wi + 1
213 return 1
214 }
215 if as_teq(spec, k0s, k0e, "chunk" as *u8) == 1 {
216 let ci: i64 = g[55]
217 if ci >= 16 { return 0 }
218 g[56 + ci] = as_tn(spec, ls, le, 1, se)
219 g[72 + ci] = as_tn(spec, ls, le, 2, se)
220 g[55] = ci + 1
221 return 1
222 }
223 if as_teq(spec, k0s, k0e, "lane" as *u8) == 1 {
224 let li: i64 = g[88]
225 if li >= 4 { return 0 }
226 g[89 + li] = as_tcopy(spec, k0e + 1, le, pool, pp)
227 g[88] = li + 1
228 return 1
229 }
230 return 0
231}
232
233func as_parse(spec: *u8, sn: i64, g: *i64, pool: *u8, pp: *i64) -> i64 {
234 var ls: i64 = 0
235 while ls < sn {
236 var le: i64 = ls
237 var seeking: i64 = 1
238 while seeking == 1 {
239 if le >= sn { seeking = 0 }
240 if seeking == 1 { if spec[le] == (10 as u8) { seeking = 0 } }
241 if seeking == 1 { le = le + 1 }
242 }
243 as_parse_line(spec, ls, le, g, pool, pp)
244 ls = le + 1
245 }
246 // refusal rails: a malformed grammar is REFUSED, never staged
247 if g[1] < 1 { return 0 }
248 if g[26] + g[27] < 2 { return 0 }
249 if g[32] == 0 { return 0 }
250 if g[38] < 1 { return 0 }
251 if g[55] < 1 { return 0 }
252 if g[88] < 2 { return 0 }
253 return 1
254}
255
256// header total bytes from hdr rows
257func as_hdr_total(g: *i64) -> i64 {
258 var t: i64 = 0
259 var i: i64 = 0
260 while i < g[1] {
261 if g[2 + i] == 0 { t = t + 4 }
262 if g[2 + i] == 1 { t = t + 4 }
263 if g[2 + i] == 2 { t = t + g[10 + i] }
264 i = i + 1
265 }
266 return t
267}
268
269// per-chunk advance under the shape: hdrw + len + pad + trail
270func as_adv(g: *i64, len: i64) -> i64 {
271 var a: i64 = g[26] + g[27] + len + g[31]
272 if g[30] == 1 { a = a + (len & 1) }
273 return a
274}
275
276// total constructed size for a chunk table
277func as_total2(g: *i64, clen: *i64, nch: i64) -> i64 {
278 var t: i64 = as_hdr_total(g)
279 var i: i64 = 0
280 while i < nch { t = t + as_adv(g, clen[i]); i = i + 1 }
281 return t
282}
283
284// construction-known want: body offset of FIRST chunk tagged tag, RELATIVE to chunk area
285func as_bodyrel2(g: *i64, ctag: *i64, clen: *i64, nch: i64, tag: i64) -> i64 {
286 var off: i64 = 0
287 var i: i64 = 0
288 while i < nch {
289 if ctag[i] == tag { return off + g[26] + g[27] }
290 off = off + as_adv(g, clen[i])
291 i = i + 1
292 }
293 return 0 - 2
294}
295
296// build the well-formed image from the grammar + a chunk table; returns total
297func as_build2(b: *u8, g: *i64, ctag: *i64, clen: *i64, nch: i64) -> i64 {
298 let total: i64 = as_total2(g, clen, nch)
299 var off: i64 = 0
300 var i: i64 = 0
301 while i < g[1] {
302 if g[2 + i] == 0 { as_put(b, off, g[10 + i], 4, 0); off = off + 4 }
303 if g[2 + i] == 1 { as_put(b, off, total - g[18 + i], 4, g[10 + i]); off = off + 4 }
304 if g[2 + i] == 2 {
305 var f: i64 = 0
306 while f < g[10 + i] { b[off + f] = 0x55 as u8; f = f + 1 }
307 off = off + g[10 + i]
308 }
309 i = i + 1
310 }
311 var s: i64 = g[0]
312 i = 0
313 while i < nch {
314 if g[28] == 1 {
315 as_put(b, off, ctag[i], g[26], 0)
316 as_put(b, off + g[26], clen[i], g[27], g[29])
317 }
318 if g[28] == 0 {
319 as_put(b, off, clen[i], g[27], g[29])
320 as_put(b, off + g[27], ctag[i], g[26], 0)
321 }
322 var j: i64 = 0
323 let bo: i64 = off + g[26] + g[27]
324 while j < clen[i] { s = as_lcg(s); b[bo + j] = (s & 0xff) as u8; j = j + 1 }
325 var p: i64 = 0
326 if g[30] == 1 { p = clen[i] & 1 }
327 if p == 1 { b[bo + clen[i]] = 0 as u8 }
328 var tr: i64 = 0
329 while tr < g[31] { s = as_lcg(s); b[bo + clen[i] + p + tr] = (s & 0xff) as u8; tr = tr + 1 }
330 off = off + as_adv(g, clen[i])
331 i = i + 1
332 }
333 return total
334}
335
336// emit one manifest scoring row
337func as_row(fd: i64, casen: *u8, key: *u8, want: i64) -> i64 {
338 as_w(fd, "row " as *u8); as_w(fd, casen); as_w(fd, " " as *u8)
339 as_w(fd, key); as_w(fd, " " as *u8); as_wn(fd, want); as_w(fd, "\n" as *u8)
340 return 0
341}
342
343// taxonomy rows for one case. kind 0=WELLFORMED (count wv[0], watches wv[1..], scalar wv[7]),
344// 1=REFUSE-KEEP-HDR (count -1, watches -2, scalar wv[7]), 2=REFUSE-ALL
345func as_case_rows2(fd: i64, casen: *u8, kind: i64, g: *i64, wv: *i64) -> i64 {
346 var cw: i64 = 0 - 1
347 if kind == 0 { cw = wv[0] }
348 as_row(fd, casen, g[32] as *u8, cw)
349 var i: i64 = 0
350 while i < g[38] {
351 var fw: i64 = 0 - 2
352 if kind == 0 { fw = wv[1 + i] }
353 as_row(fd, casen, g[39 + i] as *u8, fw)
354 i = i + 1
355 }
356 if g[33] == 1 {
357 var sw2: i64 = 0 - 2
358 if kind == 0 { sw2 = wv[7] }
359 if kind == 1 { sw2 = wv[7] }
360 as_row(fd, casen, g[34] as *u8, sw2)
361 }
362 return 0
363}
364
365// full manifest (lanes + 5 cases + taxonomy rows); tamper=1 inflates the FIRST want by 1
366func as_manifest2(path: *u8, g: *i64, wvv: *i64, wvz: *i64, tamper: i64) -> i64 {
367 let fd: i64 = sys_openat_wr(path, 0x1a4)
368 if fd < 0 { return 0 - 1 }
369 var li: i64 = 0
370 while li < g[88] {
371 as_w(fd, "lane " as *u8); as_w(fd, g[89 + li] as *u8); as_w(fd, "\n" as *u8)
372 li = li + 1
373 }
374 as_w(fd, "case valid /tmp/rs_valid.bin\n" as *u8)
375 as_w(fd, "case zerolen /tmp/rs_zerolen.bin\n" as *u8)
376 as_w(fd, "case trunc /tmp/rs_trunc.bin\n" as *u8)
377 as_w(fd, "case garbage /tmp/rs_garbage.bin\n" as *u8)
378 as_w(fd, "case overlen /tmp/rs_overlen.bin\n" as *u8)
379 let w0: i64 = wvv[0]
380 if tamper == 1 { wvv[0] = w0 + 1 }
381 as_case_rows2(fd, "valid" as *u8, 0, g, wvv)
382 wvv[0] = w0
383 as_case_rows2(fd, "zerolen" as *u8, 0, g, wvz)
384 as_case_rows2(fd, "trunc" as *u8, 1, g, wvv)
385 as_case_rows2(fd, "garbage" as *u8, 2, g, wvv)
386 as_case_rows2(fd, "overlen" as *u8, 1, g, wvv)
387 sys_close(fd)
388 return 0
389}
390
391// compute the WELLFORMED want vector (wv[0]=count wv[1..6]=watch finds wv[7]=scalar read-back)
392func as_wants(g: *i64, ctag: *i64, clen: *i64, nch: i64, img: *u8, wv: *i64) -> i64 {
393 wv[0] = nch
394 var i: i64 = 0
395 while i < g[38] {
396 wv[1 + i] = as_bodyrel2(g, ctag, clen, nch, g[47 + i])
397 i = i + 1
398 }
399 if g[33] == 1 { wv[7] = as_get(img, g[35], g[36], g[37]) }
400 return 0
401}
402
403func main(argc: i64, argv: *i64) -> i64 {
404 as_w(1, "=== ADVERSARY SUITE v2: hostile suite authored from a GRAMMAR FILE (construction = oracle) ===\n" as *u8)
405 var sp: *u8 = "knowledge/specs/race_riff.suite" as *u8
406 if argc >= 2 { sp = argv[1] as *u8 }
407 let lenp: *i64 = sys_mmap(16) as *i64
408 let spec: *u8 = sys_read_file(sp, lenp)
409 let sn: i64 = lenp[0]
410 if sn <= 0 { as_w(1, " spec MISSING: " as *u8); as_w(1, sp); as_w(1, " -- loud fail\n" as *u8); sys_exit(2); return 2 }
411 let g: *i64 = sys_mmap(8 * 128) as *i64
412 let pool: *u8 = sys_mmap(K_MAGIC_4096)
413 let pp: *i64 = sys_mmap(16) as *i64
414 if as_parse(spec, sn, g, pool, pp) != 1 { as_w(1, " grammar REFUSED (malformed spec)\n" as *u8); sys_exit(2); return 2 }
415
416 let nch: i64 = g[55]
417 let ctag: *i64 = sys_mmap(8 * 17) as *i64
418 let clen: *i64 = sys_mmap(8 * 17) as *i64
419 var ci: i64 = 0
420 while ci < nch { ctag[ci] = g[56 + ci]; clen[ci] = g[72 + ci]; ci = ci + 1 }
421
422 // WELLFORMED
423 let b: *u8 = sys_mmap(K_MAGIC_65536)
424 let total: i64 = as_build2(b, g, ctag, clen, nch)
425 as_write_file("/tmp/rs_valid.bin" as *u8, b, total)
426 let wvv: *i64 = sys_mmap(80) as *i64
427 as_wants(g, ctag, clen, nch, b, wvv)
428
429 // ZEROLEN: JUNK chunk first shifts every offset
430 let ztag: *i64 = sys_mmap(8 * 18) as *i64
431 let zlen: *i64 = sys_mmap(8 * 18) as *i64
432 ztag[0] = K_MAGIC_1247104587
433 zlen[0] = 0
434 ci = 0
435 while ci < nch { ztag[1 + ci] = ctag[ci]; zlen[1 + ci] = clen[ci]; ci = ci + 1 }
436 let zb: *u8 = sys_mmap(K_MAGIC_65536)
437 let ztotal: i64 = as_build2(zb, g, ztag, zlen, nch + 1)
438 as_write_file("/tmp/rs_zerolen.bin" as *u8, zb, ztotal)
439 let wvz: *i64 = sys_mmap(80) as *i64
440 as_wants(g, ztag, zlen, nch + 1, zb, wvz)
441
442 // TRUNC: cut mid-first-body, but never inside the scalar zone (REFUSE-KEEP-HDR contract)
443 var cut: i64 = as_hdr_total(g) + g[26] + g[27] + (clen[0] / 2)
444 if g[33] == 1 { if cut < g[35] + g[36] { cut = g[35] + g[36] } }
445 if cut >= total { cut = total - 1 }
446 as_write_file("/tmp/rs_trunc.bin" as *u8, b, cut)
447
448 // GARBAGE: seeded noise, first magic byte destroyed
449 let gb: *u8 = sys_mmap(256)
450 var gs: i64 = g[0] + 1
451 var gi: i64 = 0
452 while gi < 64 { gs = as_lcg(gs); gb[gi] = (gs & 0xff) as u8; gi = gi + 1 }
453 let m0: i64 = (g[10] >> 24) & 0xff
454 gb[0] = ((m0 + 7) & 0xff) as u8
455 as_write_file("/tmp/rs_garbage.bin" as *u8, gb, 64)
456
457 // OVERLEN: last chunk's length field inflated past EOF (bytes otherwise identical)
458 let ob: *u8 = sys_mmap(K_MAGIC_65536)
459 var oi: i64 = 0
460 while oi < total { ob[oi] = b[oi]; oi = oi + 1 }
461 var hoff: i64 = as_hdr_total(g)
462 ci = 0
463 while ci < nch - 1 { hoff = hoff + as_adv(g, clen[ci]); ci = ci + 1 }
464 var lf: i64 = hoff
465 if g[28] == 1 { lf = hoff + g[26] }
466 as_put(ob, lf, clen[nch - 1] + 1000, g[27], g[29])
467 as_write_file("/tmp/rs_overlen.bin" as *u8, ob, total)
468
469 // manifests: live + tampered twin (staging the twin must turn the referee RED)
470 as_manifest2("/tmp/race_manifest.txt" as *u8, g, wvv, wvz, 0)
471 as_manifest2("/tmp/rs_manifest_tampered.txt" as *u8, g, wvv, wvz, 1)
472
473 // durable evidence (Archivist rule)
474 let lfd: i64 = sys_openat_append("knowledge/status/adversary_suite.log" as *u8, 0x1a4)
475 if lfd >= 0 {
476 as_w(lfd, "ADVERSARY-SUITE assignment=" as *u8)
477 if g[93] != 0 { as_w(lfd, g[93] as *u8) } else { as_w(lfd, "unnamed" as *u8) }
478 as_w(lfd, " spec=" as *u8); as_w(lfd, sp)
479 as_w(lfd, " seed=" as *u8); as_wn(lfd, g[0])
480 as_w(lfd, " cases=5 chunks=" as *u8); as_wn(lfd, nch)
481 as_w(lfd, " watches=" as *u8); as_wn(lfd, g[38])
482 as_w(lfd, " valid_total=" as *u8); as_wn(lfd, total)
483 as_w(lfd, " taxonomy=WELLFORMED/ZEROLEN/TRUNC/GARBAGE/OVERLEN manifest=/tmp/race_manifest.txt tampered_twin=present\n" as *u8)
484 sys_close(lfd)
485 }
486 as_w(1, " assignment=" as *u8)
487 if g[93] != 0 { as_w(1, g[93] as *u8) } else { as_w(1, "unnamed" as *u8) }
488 as_w(1, " cases: valid(" as *u8); as_wn(1, total)
489 as_w(1, "B) zerolen(" as *u8); as_wn(1, ztotal)
490 as_w(1, "B) trunc(" as *u8); as_wn(1, cut)
491 as_w(1, "B) garbage(64B) overlen(" as *u8); as_wn(1, total)
492 as_w(1, "B); keys=" as *u8); as_wn(1, 1 + g[38] + g[33])
493 as_w(1, " construction-known\n" as *u8)
494 as_w(1, " ADVERSARY SUITE: STAGED (manifest + tampered twin written; referee may run)\n" as *u8)
495 sys_exit(0)
496 return 0
497}