omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / qualification / om2 / leak / README.txt
| 1 | OM-2 qualification leakage lane (#748, L836): contract §8 evidence (a), revised by E11/E12/E13. |
| 2 | All implementation is handwritten seeded OM-1 Omega in leakscan.om. External objdump/Python are |
| 3 | oracles only (../oracle/leak/PROVENANCE.txt). No compiler-lane or SHA-lane source was read. |
| 4 | |
| 5 | Build/run (repository root) |
| 6 | seed/out/omc < seed/qualification/om2/leak/leakscan.om > build/om2-qual/leakscan-e13 |
| 7 | chmod +x build/om2-qual/leakscan-e13 |
| 8 | build/om2-qual/leakscan-e13 [xN | pub:SLOT:OFF:LEN ...] < ARTIFACT |
| 9 | N/SLOT are entry parameter slots 0..5. xN marks DATA; otherwise entry parameters are public pointers, |
| 10 | lengths/opcodes. pub declares initially public bytes [OFF,OFF+LEN) relative to that entry pointer. |
| 11 | Up to 32 ranges, nonnegative decimal OFF/LEN with sum <= 2^55-1. An incorrect initial declaration is |
| 12 | an unsupported caller assertion. E13 checks preservation: a DATA or unclassified store that may hit |
| 13 | the range REVOKES it; secret stores are not excused as a caller assertion violation. |
| 14 | Exit: 0 PASS; 1 FAIL (data-index with no MANUAL); 2 NOT_RUN (any MANUAL, UNKNOWN or UNHANDLED); |
| 15 | 90 invalid argv; 91 malformed artifact (empty, ELF, partial word, over 8 MiB); 92 worklist limit; |
| 16 | 93 output I/O failure. NOT_RUN is never PASS. |
| 17 | |
| 18 | Output |
| 19 | @N means word offset N, byte offset 4N. Entry word 0 (or its direct B to the last function). |
| 20 | BRANCH @N mnemonic ->@target len | data never-taken-trap-check | data MANUAL [trap=code] |
| 21 | MEM @N mnemonic form base=reg index=reg const | public-index | data-index | unreached |
| 22 | PUBLIC-DECL SLOT+OFF:LEN |
| 23 | PUBLIC-MEM @N public-mem SLOT+OFF EVERY load the declaration classifies public is listed here. |
| 24 | PUBLIC-MEM-REVOKED @N public-mem SLOT+OFF:LEN potentially poisoning store (or unclassified word). |
| 25 | UNKNOWN @N 0xword; UNHANDLED @N reason; SUMMARY class counts; VERDICT TRACE-EQUIV-STATIC ... |
| 26 | The legacy summary field trap-check counts only E12 PROVED checks; data-branch counts MANUAL branches |
| 27 | (trap targets included). MANUAL-ITEMS enumerates UNKNOWN/UNHANDLED; data MANUAL branches are listed |
| 28 | individually and counted in data-branch. All conditional branches are listed, including B.AL/NV. |
| 29 | All memory accesses with a base other than SP/FP, or any register index, are listed. SP+immediate |
| 30 | spill slots are modeled but not listed. Literal-pool loads are public, not an indexed address. |
| 31 | |
| 32 | E12 safety correction (supersedes the original structural trap rule) |
| 33 | A branch to a trap stub is NOT sufficient proof that it is never taken. Required negative control: |
| 34 | fn f a view ulong 4 to uint / ret uint get a 0 / end |
| 35 | This scans data MANUAL trap=5, verdict NOT_RUN. Native program-mode twins reachable-zero.om and |
| 36 | reachable-big.om execute that same loaded conversion with 0 and 2^32: gate checks exits 0 and 105. |
| 37 | Only a conversion CBNZ-to-trap whose check register is proven zero through an AND with a known |
| 38 | constant mask can be discharged. The check tracks known-zero bits for GPRs: constants, MOVK, AND-immediate |
| 39 | (Arm DecodeBitMasks) or AND-register, copies and UBFM/LSR. AND-proof provenance must survive to the |
| 40 | check; canonicalization of a loaded narrow value alone is not an AND proof. Joins intersect zero |
| 41 | bits and proof bits. CBNZ with all bits known zero and AND provenance is data never-taken-trap-check. |
| 42 | The positive trap-check.om uses AND 0xffffffff followed by LSR #32; it remains PASS. |
| 43 | Other DATA branches, including structurally identified trap edges, are MANUAL and force NOT_RUN. |
| 44 | Memory data-index still fails absent a MANUAL item. Speculative execution, latency and caches are |
| 45 | outside the claim (§8 lines 239-241). This is finite static evidence, not a mechanized proof. |
| 46 | |
| 47 | Decode subset (main acb3f15 omc emission, no candidate source dependency) |
| 48 | - B/BL; B.cond; CBZ/CBNZ; TBZ/TBNZ; RET/BR/BLR; SVC; NOP/DSB. |
| 49 | - ADD/SUB(S) immediate, shifted and extended; logical immediate and shifted-register; MOVZ/N/K; |
| 50 | SBFM/BFM/UBFM; ADR/ADRP; ADC/SBC, CCMP/CCMN, CSEL/CSINC/CSINV/CSNEG (CSET alias). |
| 51 | - UDIV/SDIV, LSLV/LSRV/ASRV/RORV, RBIT/REV/CLZ/CLS, MADD/MSUB and widening/high multiply. |
| 52 | - EXTR/ROR-immediate, RORV and NEG were already covered by the instruction classes; the independent |
| 53 | citations are Arm DDI0487M.d C6.2.160 p2201 (EXTR), C6.2.349 p2580 (RORV, DP2 opcode 11), and |
| 54 | C6.2.295 p2475 (NEG = SUB from XZR, not SP). No S1 source was consulted. |
| 55 | - Scalar FP moves/conversions, one/two-source ops and comparisons, single/double precision. |
| 56 | - Loads/stores: unsigned immediate, register offset (UXTW/UXTX/SXTW/SXTX + scale), unscaled/pre/post, |
| 57 | LDP/STP/LDPSW and LDR literal. Reserved/unallocated patterns are UNKNOWN, including invalid sf/N, |
| 58 | logical masks, shifts, opcode/type fields, PRFM, and constrained-unpredictable writeback aliases. |
| 59 | Om1 emission references: omc.om ldop/stop 1321/1354; e3 1498; matconst 1568; canon 1595; cset 1653; |
| 60 | bo_* 1894-2083; scalar FP 2088-2355; save/loadarg/restore 2460-2524; elemaddr 2547; finish 5633-5670. |
| 61 | SIMD/SVE, atomics/exclusives, system-register instructions and other encodings are UNKNOWN. |
| 62 | |
| 63 | Taint/CFG rules |
| 64 | - May-DATA bits for x0..x30, NZCV and v0..v31, OR at joins. Flag-setting ops REPLACE NZCV taint by |
| 65 | sources; CSET/CSEL/ADC/CCMP read flags. Memory values DATA except literal loads, tracked spill slots |
| 66 | and proven declared-public loads. Entry x7/runtime and x30/return address public; other nonparameter |
| 67 | registers and flags start DATA. Constants/ADR/ADRP/zero-register public. |
| 68 | - Worklist to fixpoint; conditional branches have both successors (AL/NV only target). Direct calls |
| 69 | join caller argument/register states into callee entry. Each RET joins into an exit summary, which |
| 70 | requeues reached callers. Registers/flags after BL come from the callee summary; caller spill state |
| 71 | is restored separately. This is context-insensitive: distinct call sites lose differing constants. |
| 72 | - SP depth and current 64 eight-byte spill slots are modeled. omc save/restore lowers SP, spills all |
| 73 | live pool registers + x30, reloads args, BLs, reloads preserved values and releases the frame. |
| 74 | Spill loads carry saved taint AND exact pointer/constant provenance, not unconditional DATA. |
| 75 | - SP writes other than ADD/SUB SP,SP,#imm, SP writeback, accesses outside the current frame, mismatched |
| 76 | depths/functions, nonzero RET depth, DATA x30, indirect BR/BLR, SVC, out-of-artifact flow or writes |
| 77 | to x7 are UNHANDLED and force NOT_RUN. Exact-provenance record exhaustion also does (provenance-cap). |
| 78 | - omc invariant A1: computed-base array writes never alias spill slots. Arrays precede calls on the |
| 79 | stack, spill areas are below them, and runtime/compile-time index checks prevent cross-array writes |
| 80 | (sa_arr 4922, elemaddr 2547). This invariant is assumed, not re-proved for arbitrary machine bytes. |
| 81 | - The trap shape is MOVZ X1,#1..14; B to MOV X0,X7; LDR X16,[X7,#16]; BR X16. Those paths terminate; |
| 82 | the runtime trap is assumed nonreturning. Shape identifies the trap target, NOT its unreachability. |
| 83 | |
| 84 | Public-memory provenance / P1 resolution |
| 85 | Each GPR carries unknown, an exact signed constant, or original-entry-slot base + exact constant. |
| 86 | MOV, ADD/SUB immediate and ADD/SUB register with constant shifted/extended operand propagate it; |
| 87 | MOVZ/N/K build constants. Narrowing a pointer loses its identity. Spill slots, function inputs and |
| 88 | exit summaries carry the same domain. Unequal provenance joins to unknown. No intervals, loop |
| 89 | induction or call specialization. Constants/offsets outside signed 56 bits are conservatively unknown. |
| 90 | Whole aligned eight-byte spills preserve identity; partial stores invalidate every overlapping slot. |
| 91 | All bytes of a load (both elements of a pair) must fit a declaration; no wrap or one-past-end admission. |
| 92 | P1 uses explicit declarations, never an implicit blanket memory declassification. E13 also requires |
| 93 | the declared range to survive the store scan below. Current OM-1 SHA getle(c,p,nb) shares call sites |
| 94 | and loops over p+i, so its count loads remain unknown in this exact domain even without revocation. |
| 95 | With E13, pub:0:32:8 is conservatively revoked by 68 stores. Its 15 original count-derived items |
| 96 | remain listed for manual classification, not passed; E12 adds nine unproved DATA trap checks. |
| 97 | Result: ten discharged checks, 16 MANUAL branches, eight data-index accesses, NOT_RUN. See notes. |
| 98 | |
| 99 | E13 preservation check (sound whole-artifact fallback, not flow-sensitive memory contents) |
| 100 | After CFG fixpoint, inspect EVERY word, including stores with no reached state. A DATA value or |
| 101 | address, unreached/unclassified store, UNKNOWN instruction or UNHANDLED construct is potentially |
| 102 | poisoning. An unknown base/address may hit every nonempty declaration; different entry-slot roots |
| 103 | are not assumed disjoint. A store is proven outside only when exact same-slot byte extents do not |
| 104 | overlap, or when it is a proven current-frame SP+immediate spill (existing A1 frame-separation rule). |
| 105 | Classified public-value/public-address stores are length-dependent and do not revoke declarations. |
| 106 | For every poisoning word/range pair, record PUBLIC-MEM-REVOKED with its word offset. Revoke the |
| 107 | whole range for the entire scan, including earlier loads; reset taint, provenance and summaries, |
| 108 | and rerun to fixpoint. Repeat until no new range is revoked (at most 32 revocations). This also |
| 109 | handles stores whose DATA dependencies are revealed only by a prior declaration revocation. |
| 110 | Public-load annotations come only from the final analysis, never from a provisional pass. |
| 111 | pub-secret.om pins the reported E13 false PASS; pub-unknown.om pins unknown-address revocation; |
| 112 | pub-outside-store.om proves a secret store at byte40 does not poison public [32,40). Native drivers |
| 113 | pub-secret-zero/one concatenate with the same function and execute exits0/1, showing different paths. |
| 114 | Dynamic traces and the OM-2 SHA artifact remain NOT_RUN here. |
| 115 | |
| 116 | Cases/evidence (all paths relative to seed/qualification/om2) |
| 117 | leak/leak.cases runs now under 734f0a39; leak/candidate.cases runs common cases under a candidate and |
| 118 | compiles s1-rot.om. Binary input identities are in leak.cases; expected reports are hand-derived from |
| 119 | construction and objdump offsets, not copied as behavioral truth from a compiler under test. |
| 120 | evidence/phaseB/leak-pinned.log and leak-candidate-s1.log record gates; leak-sha256-om1.txt and |
| 121 | leak-sha256-om1-pub.txt hold full corrected scans; leak-s1-rot.txt records source/artifact identities, |
| 122 | scan and objdump cross-check. leak-reachability.txt records both E12 and E13 native control outcomes. |
| 123 | leak-corpus-xcheck.txt: 31 baseline function-mode units cross-checked. leak-fuzz.txt: historical decoder |
| 124 | fuzz before E12; decoder classes unchanged, not evidence for the added provenance/known-bits analysis. |
| 125 | |
| 126 | Mutant kills (exact exits plus stdout differs from the corresponding expected report) |
| 127 | cbtaint/trap-check: exit0, check mislabeled len; loadpub/data-branch: exit0 false PASS; |
| 128 | callexit/call-data: exit0 false PASS; slotoff/call-public: exit2 ret-x30-data; |
| 129 | flagsweak/flags: exit2, public compare wrongly DATA; nostub/trap-check: exit2 br-indirect; |
| 130 | pubrange/public-out: exit0 false PASS because one-past-end byte incorrectly declared public. |
| 131 | norevoke/pub-secret: exit0 false PASS when the E13 store scan is omitted; must differ from NOT_RUN. |
| 132 | Native-reachability controls pin the earlier false-PASS defect. Candidate compiler leak mutants |
| 133 | must produce a new MANUAL branch, data-index, UNKNOWN or UNHANDLED item; they are never accepted |
| 134 | as PASS. Removing unroll is not a leak mutant (constant-bound loop branches remain public). |