interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / AUDIT_SCOPE.md

226 lines · 15065 bytes Raw Blame History Source

Audit scope

Written for an outside, independent security audit. Revision described: 2954d46866f9867dea6d62853f68273773f01805, which is main at 4ad48c45 plus the conformance change that keeps the CPU run off the GPU, 2026-11-05. Everything below is taken from the repository's own files at that revision. Every command under "Run every test" was run from a clean clone of that revision on 2026-11-05; the logs, the exit-code table and the tool versions are in evidence/audit/2026-11-05-2954d46/. Items marked NOT_RUN were not executed.

What this repository is

Omega Bridge is a compiler written in Omega that emits executable C (GNU C11, POSIX) and Python 3 from a checked, bounded subset of Omega (ABI v0). src/native.om generates C bindings so C, C++, Python, Rust, Zig and Go can call machine code produced by the seeded Omega compiler (native call ABI v1 for OM-1 units and ABI v2 for OM-2 units, docs/NATIVE-ABI.md). `tools/native --freestanding` emits an AArch64 object with no hosted runtime for pure integer-scalar OM-1 units and, since #45, for OM-2 units without host effects (outputs freest and fapic). tools/native --target x86linux emits hosted x86-64 SysV Linux bindings from a separately pinned x86 compiler; that path is EXERCISED under emulation only (evidence/native-x86-be8c5130.json) and native x86-64 execution is NOT_RUN. src/gpu_adapter.om is an opt-in GPU adapter that negotiates and admits artifacts; it opens no device and converts no host program. max-cpu/ runs an Omega kernel as a Modular MAX 26.7.0 CPU custom op (status EXERCISED on a host CPU; evidence/MAX-CPU/README.md). The default target is Linux AArch64. There is no C or Python input frontend. The Python under tests/ and conformance/ is test infrastructure and does not ship. Status: local differential tests and caller demos; independent review required before release.

What to review, in priority order

  1. src/toc.om. Lexer, type and name tables, typed expression nodes, and the C and Python emitters. Check that every runtime check in the source language (array bounds, signed overflow trap 1, division trap 2, shift trap 7, loop guards, 128-active-call limit) is emitted in both targets, that capacity exhaustion refuses with error 13, 14, 23 or 24 and writes no partial output, and that refused features (docs/CAPABILITIES.md) are refused.
  2. tools/bridge. The shell entry point snapshots the input once, runs the pinned seed's whole-unit check, then generates from the same bytes, and refuses to run if build/compiler.sha256 no longer matches. Check the snapshot cannot be swapped (time of check to time of use) and that output reaches stdout only after success.
  3. src/native.om and docs/NATIVE-ABI.md. Generated C bindings for foreign callers: argument and length marshalling, aliasing of inputs and results, stack size requirement (eight MiB), BTI on C callers.
  4. src/gpu_adapter.om and docs/GPU-ADAPTER.md. A key=value wire protocol on stdin/stdout. Check that unknown, duplicate or out-of-order keys are refused, that REFUSE is final, and that the adapter never returns a device pointer, address or handle.
  5. tools/bootstrap.sh, tools/build.sh, tools/build-gpu-adapter.sh. Supply chain: fetch of the pinned Omega commit, seed growth, fixpoint check, and sha256 enforcement of OMEGA_SEED.
  6. tools/run-device-window.sh and conformance/. Device-run wrapper (AGENTS.md: never resets the GPU, changes the driver or touches a serving process) and the Omega versus Modular MAX conformance test suite.
  7. Test integrity: tools/test.sh, tests/differential.py, tests/refusals.py, tests/attachments.py, tests/controls.py, tests/robustness.py, tests/native/run.sh, tests/native/v2/run.sh (ABI v2 and freestanding), tests/native/kinds.sh (f32 and ushort array kinds), tests/native/test_freestanding.py, tests/native/x86/run.sh (x86linux, EMULATED), tests/native/test_build_failures.sh, tests/gpu/test_gpu_adapter.py, max-cpu/run.sh and max-cpu/test_run_evidence.py.

.github/workflows/ci.yml (added by the audit-readiness change) replays the compiler from source with tools/bootstrap.sh and runs sh tools/test.sh on a GitHub-hosted arm64 runner; tests/gpu stays NOT_RUN there. A second job publishes an SPDX SBOM artifact. Every action is pinned by commit sha and the token is read-only.

Trust boundaries

Threat model summary

Build from source at a pin

Needs Linux AArch64, git, sh, file, sha256sum, gcc and python3. The bootstrap uses no C compiler, assembler or linker.

sh tools/bootstrap.sh     # ends with: bootstrap fixpoint RC=0
tools/build.sh            # builds build/bridge from src/toc.om

OMEGA_SOURCE may point at an existing Omega checkout (read only); otherwise the bootstrap needs network access to the upstream repository. On a shared build host the README prefixes commands with quiet-build; without it, run the scripts directly.

Run every test

Each command below lists every environment variable it reads; the values CI uses are in .github/workflows/portable.yml. OMC is omega-mv seed/out/omc (sha256 734f0a39…, the PIN line of tools/native), OMC2 is omega-mv hoist/865-main @ 7286d61d (07820046…), HOST_OMC2 is #1008 @ 2992a68b (c000ec02…), XOMC is the x86 compiler (the X86_PIN line, be8c5130…), and SOMC is the seeded compiler for tests/seeded*.py and tests/freest.py (omega-mv e5b32567, 2c824805…). The three native-v2 compiler roles are digest-checked. DEVICE_OMC2 is the context-format compiler (6d1b1cf5…); DEVICE_SOURCE is its seed/omc/omc.om, checked by rebuilding the fingerprint. Exact pins and seed-only rebuilds: AArch64 qualification. On the shared Spark, run every command below inside bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10.

tools/test.sh
python3 tests/attachments.py
OMEGA_NATIVE_OMC=$OMC sh tests/native/run.sh
OMEGA_NATIVE_OMC=$OMC OMEGA_NATIVE_OMC2=$OMC2 OMEGA_NATIVE_HOST_OMC2=$HOST_OMC2 OMEGA_NATIVE_DEVICE_OMC2=$DEVICE_OMC2 OMEGA_NATIVE_OMC2_SOURCE=$DEVICE_SOURCE sh tests/native/v2/run.sh
python3 tests/native/v2/test_verdict.py
OMEGA_NATIVE_OMC=$OMC sh tests/native/kinds.sh
OMEGA_NATIVE_OMC=$OMC sh tests/native/g1/run.sh
OMEGA_NATIVE_OMC=$OMC OMEGA_NATIVE_X86_OMC=$XOMC QEMU_X86_64=/path/to/qemu-10.0.14/qemu-x86_64 \
  OMEGA_NATIVE_X86_PYTHON=/path/to/x86/python3.12 OMEGA_NATIVE_X86_LIBPATH=/path/to/x86/python/lib \
  sh tests/native/x86/run.sh
OMEGA_NATIVE_OMC=$OMC ZIG=/path/to/zig GO=/path/to/go sh tests/native/test_build_failures.sh
<same five x86 variables> OMEGA_NATIVE_X86_BAD_QEMU=/path/to/qemu-8.2.2/qemu-x86_64 \
  python3 tests/native/x86/test_build_failures.py
OMEGA_SEEDED_OMC=$SOMC OMEGA_SEED=build/bootstrap/omc python3 tests/seeded.py
OMEGA_SEEDED_OMC=$SOMC python3 tests/seeded_float.py
OMEGA_SEEDED_OMC=$SOMC OMEGA_SEED=build/bootstrap/omc FREEST_CUDAPP_ROOT=/path/to/CUDApp \
  python3 tests/freest.py
<same three> CC=x86_64-linux-gnu-gcc FREEST_RUNNER='qemu-x86_64 -L /usr/x86_64-linux-gnu' \
  python3 tests/freest.py
OMEGA_SEEDED_OMC=$SOMC OMEGA_SEED=build/bootstrap/omc python3 tests/freest_views.py
OMEGA_SEED=build/bootstrap/omc sh tools/build-gpu-adapter.sh
python3 tests/gpu/test_gpu_adapter.py
MAXPY=/path/to/venv/bin/python conformance/run.sh      # needs ../../cudapp built: make all
python3 max-cpu/test_run_evidence.py
MAXPY=/path/to/venv/bin/python OMEGA_REPO=/path/to/omega-mv max-cpu/run.sh
conformance/run.sh --device
tools/run-device-window.sh --ledger <ID>

Results from a clean clone of 2954d46 on 2026-11-05 (Linux AArch64 host, rustc 1.98.1, Go 1.27.3, Zig 0.13.0, GCC 13.3.0, MAX 26.7.0; evidence/audit/2026-11-05-2954d46/):

CommandExitFinal line
tools/test.sh0ALL SUITES RC=0 (113 + 50 + 2 + 7 + 225 = 397 cases, 0 failures)
tests/attachments.py0attachment cases=2 failures=0 RC=0
tests/native/run.sh0NATIVE-CALL PASS (not run: none)
tests/native/v2/run.sh0NATIVE-V2 PASS (not run: none)
tests/native/v2/test_verdict.py05 tests OK
tests/native/kinds.sh0NATIVE-KINDS PASS
tests/native/g1/run.sh0G1-CALC PASS (not run: none)
tests/native/x86/run.sh0NATIVE-X86 EMULATED PASS; native x86 NOT_RUN
tests/native/test_build_failures.sh0PASS native callers: Zig and Go built and executed
tests/native/x86/test_build_failures.py0NATIVE-X86 CONTROLS PASS (EMULATED; native x86 NOT_RUN)
tests/seeded.py0SEEDED CONVERTER differential C/Python/native/x86 and pin/arithmetic/ABI controls PASS; device NOT_RUN
tests/seeded_float.py0PASS seeded binary32 byte differential; …
tests/freest.py, AArch64 and x86 user-mode0, 0PASS direct structural converter refusals …
tools/build-gpu-adapter.sh, tests/gpu/test_gpu_adapter.py0, 0{"checks": 47, "fail": 0}
conformance/run.sh0CONFORMANCE HARNESS PASS; device runs NOT_RUN
max-cpu/test_run_evidence.py, max-cpu/run.sh0, 0OMEGA MAX CPU: PASS (controls green, negatives red as expected)
conformance/run.sh --device, tools/run-device-window.sh—NOT_RUN (GPU window not authorized for this refresh)

Known limitations and NOT_RUN

Dependencies and provenance

Evidence

Raw logs and manifests live in evidence/ (numbered red and green logs, manifest.json, differential-results.json, control-results.json, files.sha256, native-call-v1/, MAX-INTEROP/, and the clean-clone runs of this document in audit/2026-11-05-2954d46/). AGENTS.md: keep the failing log beside the passing one, and never rewrite an existing evidence log. Cross-repository receipts, where filed, belong under aien-dev/aien-receipts omega-bridge/<sha>/; whether any exist is unknown from the repository. Receipts are append-only and never edited.