nx_nxa_secdump_gate.nx
buildroot/runtime/nx_nxa_secdump_gate.nx
about
nx_nxa_secdump_gate.nx -- THE GATE FOR THE NXA SECTION INSPECTOR.
SUBJECT: the nx_nxa_secdump ELF, forked for real against NXA containers this gate BUILDS AT
RUNTIME under /tmp/nx_nxa_secdump_gate/. Nothing here reads a production asset, so the gate
cannot report on a fixture it shares with a beat (the gate-fixture law), and it cannot be
silently re-baselined by someone re-baking ref9d.
WHY EACH TOOTH EXISTS. The organ's whole value is that its NEGATIVE answers are trustworthy:
a reader that says MATCH on a corrupt section, or OK on a container it could not parse, is
worse than no reader at all -- it would launder a broken asset as verified. So every refusal
path is bitten with a fixture built to trigger exactly that path, and the good fixture is
carried alongside as the positive control, because A GUARD THAT REFUSES EVERYTHING PASSES
EVERY NEGATIVE TEST.
The fixtures are constructed with nxa_check2 -- the format's ONE checksum definition, the same
one the subject uses -- so the gate cannot drift from the organ by re-implementing the rule it
is testing. That is deliberate and it is a REAL limitation, stated rather than hidden: this
gate proves the reader agrees with the format library, not that the format library is right.
The checksum itself is nx_nxa's to prove.
nx_nxa_secdump_gate [subject_elf]
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_nxa.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
| 31 | const NG_SUBJECT_DEFAULT: *u8 = "/volume1/homes/elderwesto/nishihost/buildroot/_build/nx_nxa_secdump.sov.elf" |
| 34 | const NG_OK: i64 = 0 |
| 35 | const NG_E_USAGE: i64 = 2 |
| 36 | const NG_E_BAD: i64 = 3 |
| 37 | const NG_E_NOTAG: i64 = 4 |
| 38 | const NG_E_CKSUM: i64 = 5 |
| 39 | const NG_E_EXEC: i64 = 127 |
| 41 | const NG_DIR: *u8 = "/tmp/nx_nxa_secdump_gate" |
| 42 | const NG_GOOD: *u8 = "/tmp/nx_nxa_secdump_gate/good.nxa" |
| 43 | const NG_CORRUPT: *u8 = "/tmp/nx_nxa_secdump_gate/corrupt.nxa" |
| 44 | const NG_BADMAG: *u8 = "/tmp/nx_nxa_secdump_gate/badmagic.nxa" |
| 46 | const NG_MODEDIR: i64 = 493 |
| 47 | const NG_CAPCAP: i64 = 262144 |
| 48 | const NG_ARGV_BYTES: i64 = 64 |
| 49 | const NG_SCRATCH: i64 = 16 |
| 52 | const NG_HDR: i64 = 32 |
| 53 | const NG_DIRENT: i64 = 32 |
| 54 | const NG_WORD: i64 = 8 |
| 55 | const NG_NSEC: i64 = 2 |
| 56 | const NG_A_WORDS: i64 = 3 |
| 57 | const NG_B_WORDS: i64 = 2 |
| 58 | const NG_OFF_A: i64 = 96 // NG_HDR + NG_NSEC*NG_DIRENT |
| 59 | const NG_OFF_B: i64 = 120 // NG_OFF_A + NG_A_WORDS*NG_WORD |
| 60 | const NG_FLEN: i64 = 136 // NG_OFF_B + NG_B_WORDS*NG_WORD |
| 61 | const NG_A_W0: i64 = 11 |
| 62 | const NG_A_W1: i64 = 22 |
| 63 | const NG_A_W2: i64 = 33 |
| 64 | const NG_B_W0: i64 = 44 |
| 65 | const NG_B_W1: i64 = 55 |
| 66 | const NG_A_W0_MUT: i64 = 12 // one word changed -> the section checksum must stop matching |
| 67 | const NG_MAGIC_MUT: i64 = 88 // 'X' -- breaks NXANIM01 at byte 0 |
| 68 | const NG_CHECK_SEED: i64 = 1 |
| 69 | const NG_DIR_WORDS: i64 = 8 // NG_NSEC * 4 |
| 70 | const NG_BYTE: i64 = 256 |
| 71 | const NG_BYTE_MASK: i64 = 255 |
| 72 | const NG_TOP_BYTE: i64 = 7 |
| 73 | const NG_VER: i64 = 1 |
| 75 | const NG_TAG_A: *u8 = "AAAA" |
| 76 | const NG_TAG_B: *u8 = "BBBB" |
| 77 | const NG_TAG_Z: *u8 = "ZZZZ" |
| 78 | const NG_WORDS2: *u8 = "2" |
| 79 | const NG_NONNUM: *u8 = "xx" |
functions
| 81 | func ng_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: ng_has |
| 82 | func ng_wr64(b: *u8, off: i64, v: i64) -> i64 |
| 89 | func ng_wrw(b: *u8, off: i64, v: i64) -> i64 called by 1: ng_build |
| 94 | func ng_wrtag(b: *u8, off: i64, t: *u8) -> i64 called by 1: ng_build |
| 101 | func ng_exists(path: *u8, want: i64) -> i64 |
| 110 | func ng_has(buf: *u8, n: i64, pat: *u8) -> i64 |
| 127 | func ng_build(path: *u8, mutate_payload: i64, mutate_magic: i64) -> i64 |
| 165 | func ng_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, cap: *u8, olen: *i64) -> i64 |
| 175 | func main(argc: i64, argv: *i64) -> i64 |