Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/docs/NATIVE-X86-PHYSICAL.md # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / docs / NATIVE-X86-PHYSICAL.md` 194 lines · 9843 bytes Raw Blame History Rendered 1 # Native x86-64 execution: runbook and receipt format 2 3 Every x86 receipt so far (`evidence/native-x86-`be8c5130`.json`, 4 `evidence/native-x86-pr44-merge/receipt.json`) is `EMULATED_PASS`: the callers ran 5 under `qemu-x86_64` on an AArch64 host and `native_x86` is `NOT_RUN`. This page 6 says how to run the same suite with the callers executing on an x86-64 CPU, and 7 how to record the result. 8 9 ## What the mode does 10 11 `OMEGA_NATIVE_X86_EXEC=native` makes `tests/native/x86/suite.py` execute every 12 target executable (the six callers, the saved-register and status oracles, the 13 TLS and out-of-line API checks) directly instead of as 14 `qemu-x86_64 -L SYSROOT [-E LD_LIBRARY_PATH=…] exe`. `OMEGA_NATIVE_X86_LIBPATH`, 15 when set, becomes the executable's `LD_LIBRARY_PATH`. Nothing else changes: the 16 same compilers, pins, sources, oracles and checks run, and AArch64 byte parity 17 against ``f637021`` is still required. 18 19 The default (`qemu`, or the variable unset) keeps the emulated run and its 20 output unchanged. Any other value fails preflight before a caller is built. 21 22 In native mode preflight: 23 24 - fails unless `uname -m` is `x86_64` 25 (`FAIL native execution host is x86-64 (uname -m aarch64)` on the Spark); 26 - prints `INFO cpu model=`, `INFO cpu hypervisor flag=yes|no`, `INFO kernel=`, 27 `INFO virtualization=` (from `systemd-detect-virt`; `unknown` if that is 28 absent) and, if registered, `INFO binfmt qemu-aarch64 interpreter=`; 29 - requires both pinned compilers to execute on the host. They are AArch64 30 executables (`file` reports `ELF 64-bit LSB executable, ARM aarch64`), so an 31 x86 host needs binfmt_misc `qemu-aarch64`. QEMU here runs only the compilers. 32 Their outputs are byte-compared against the AArch64 baseline by the suite's 33 parity checks, and every target executable still runs on the host CPU. 34 - does not use or probe `qemu-x86_64`. The QEMU oracle probes run only in 35 `qemu` mode. 36 37 Check names and the aggregate line say `NATIVE` instead of `EMULATED`. A 38 successful run ends with 39 40 ``` 41 NATIVE-X86 NATIVE PASS (six languages built and run on the host x86-64 CPU; virtualization=) 42 ``` 43 44 The suite never prints `PHYSICAL`. A cloud VM or a container on a hypervisor is 45 a native run on a virtual CPU, not a physical qualification; the receipt rule 46 below decides the label. 47 48 ## Host prerequisites 49 50 An x86-64 Linux host with: 51 52 | Need | Ubuntu 24.04 example | Checked by | 53 | --- | --- | --- | 54 | C/C++ for x86-64 | `gcc g++ binutils` (`x86_64-linux-gnu-gcc`, `-g++`, `-nm`, `-objdump` are the host tools) | suite `CC`, `CXX`, `NM`, `OBJDUMP` | 55 | Rust with the x86-64 std | `rustc` (rustup stable is fine) | suite `RUSTC` | 56 | Zig 0.13 | , SHA256 ``d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea`` (from ziglang.org `download/index.json`) | suite `ZIG` | 57 | Go with cgo | any Go release with cgo enabled | suite `GO` | 58 | x86 Python 3 | the host `python3` (`OMEGA_NATIVE_X86_PYTHON=$(command -v python3)`) | suite `OMEGA_NATIVE_X86_PYTHON` | 59 | AArch64 binfmt | `qemu-user-binfmt` or `qemu-user-static` | native preflight | 60 | Full git clone of omega-bridge | `git clone`, not `--depth 1` (the parity check reads ``f637021``) | parity checks | 61 62 Record the version of each tool (`gcc --version`, `rustc --version`, 63 `zig version`, `go version`, `python3 --version`, the binfmt interpreter's 64 `--version` and sha256) in the receipt. 65 66 ## Compilers 67 68 Both are pinned by sha256 in `tools/native` and checked by the suite before use: 69 70 | Variable | sha256 | Source | 71 | --- | --- | --- | 72 | `OMEGA_NATIVE_OMC` (generator) | ``734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`` | `git -C omega-mv show `e17039d9ceeb30e0637ef4145e37afc5821c3773`:seed/out/omc` | 73 | `OMEGA_NATIVE_X86_OMC` (x86 target) | ``be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`` | `git -C omega-mv show `474197e4fa0207e0e2fb3c0494594a975f5031fa`:seed/out/omc` | 74 75 ```sh 76 git -C omega-mv show `e17039d9ceeb30e0637ef4145e37afc5821c3773`:seed/out/omc > omc-gen 77 git -C omega-mv show `474197e4fa0207e0e2fb3c0494594a975f5031fa`:seed/out/omc > omc-x86 78 chmod +x omc-gen omc-x86 79 sha256sum omc-gen omc-x86 # must print the two pins above 80 ``` 81 82 These are `PIN` and `X86_PIN` in `tools/native`. The separate hosted pin 83 `X86_HOST_PIN` (``c5ac9979`…`, selected by `tools/native --host`) is not used by 84 `tests/native/x86/run.sh`; a physical receipt names `X86_PIN`. 85 86 ## Commands 87 88 From the omega-bridge checkout at the commit under test, with fresh empty 89 output directories: 90 91 ```sh 92 export OMEGA_NATIVE_OMC=$PWD/../omc-gen OMEGA_NATIVE_X86_OMC=$PWD/../omc-x86 93 export ZIG=/opt/zig-linux-x86_64-0.13.0/zig GO=$(command -v go) 94 export OMEGA_NATIVE_X86_PYTHON=$(command -v python3) 95 export OMEGA_NATIVE_X86_EXEC=native 96 97 # 1. The suite. 98 sh tests/native/x86/run.sh build/x86-native 2>&1 | tee x86-native.log 99 100 # 2. Controls: failed Zig/Go builds, missing Zig/Go and an unknown execution 101 # mode must all refuse aggregate PASS; then the positive run must print NATIVE. 102 # (The known-bad QEMU control is NOT_RUN in native mode.) 103 python3 tests/native/x86/test_build_failures.py build/x86-native-controls \ 104 2>&1 | tee x86-native-controls.log 105 106 # 3. Wrong-pin control: the generator compiler offered as the x86 compiler. 107 OMEGA_NATIVE_X86_OMC=$OMEGA_NATIVE_OMC \ 108 sh tests/native/x86/run.sh build/x86-native-wrongpin 2>&1 | tee x86-native-wrongpin.log 109 110 # 4. Mutated-compiler control: tools/native must refuse a changed x86 compiler. 111 cp "$OMEGA_NATIVE_X86_OMC" omc-x86-mut && printf '\0' >> omc-x86-mut 112 OMEGA_NATIVE_X86_OMC=$PWD/omc-x86-mut \ 113 sh tools/native --target x86linux build/x86-native-mut tests/native/x86/follow.om \ 114 2>&1 | tee x86-native-mut.log 115 ``` 116 117 Expected: 1 and 2 exit 0, ending with the `NATIVE PASS` line and 118 `NATIVE-X86 CONTROLS PASS (NATIVE; …)`; 3 exits 1 with 119 `NATIVE-X86 FAIL x86 compiler pin`; 4 exits 1 with `tools/native` reporting an 120 x86 omc sha256 that differs from the pin. 121 122 ## Receipt 123 124 Write `evidence/native-x86-physical-.json` (for 125 the current pin, `evidence/native-x86-physical-`be8c5130`.json`). It extends the 126 schema-1 fields of `evidence/native-x86-`be8c5130`.json`: 127 128 ```json 129 { 130 "schema": 1, 131 "status": "NATIVE_PASS", 132 "label": "PHYSICAL", 133 "bridge_commit": "", 134 "x86_omc_sha256": "`be8c51301307555254fc59e351d281aae1aa096d91521777e33a41c8b446448a`", 135 "baseline_omc_sha256": "`734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`", 136 "native_x86": "PASS", 137 "host": { 138 "cpu_model": "", 139 "hypervisor_flag": "no", 140 "virtualization": "none", 141 "kernel": "", 142 "os": "", 143 "binfmt_qemu_aarch64": {"interpreter": "", "version": "", "sha256": ""} 144 }, 145 "toolchains": {"gcc": "", "g++": "", "rustc": "", "zig": "", "go": "", "python": ""}, 146 "commands": [ 147 {"command": "OMEGA_NATIVE_X86_EXEC=native sh tests/native/x86/run.sh EMPTY_OUTPUT", "exit": 0, "result": " PASS, 0 FAIL; NATIVE-X86 NATIVE PASS"}, 148 {"command": "OMEGA_NATIVE_X86_EXEC=native python3 tests/native/x86/test_build_failures.py EMPTY_OUTPUT", "exit": 0, "result": "NATIVE-X86 CONTROLS PASS (NATIVE)"}, 149 {"command": "OMEGA_NATIVE_X86_EXEC=native OMEGA_NATIVE_X86_OMC=<`734f0a39` omc> sh tests/native/x86/run.sh EMPTY_OUTPUT", "exit": 1, "result": "negative control: FAIL x86 compiler pin"}, 150 {"command": "OMEGA_NATIVE_X86_OMC=<`be8c5130` omc with one byte appended> sh tools/native --target x86linux OUTDIR tests/native/x86/follow.om", "exit": 1, "result": "negative control: tools/native refused"} 151 ], 152 "logs_sha256": {"x86-native.log": "", "x86-native-controls.log": "", "x86-native-wrongpin.log": "", "x86-native-mut.log": ""} 153 } 154 ``` 155 156 Fill each field from the run's own output; copy no value from this template. 157 Commit the four logs next to the receipt in 158 `evidence/native-x86-physical-/` so `logs_sha256` can be rechecked. 159 160 Label rule: 161 162 - `PHYSICAL` only when the suite printed `virtualization=none` **and** 163 `cpu hypervisor flag=no`, and the receipt names the machine. 164 - Any other virtualization value, or the hypervisor flag set, is `VIRTUAL`. 165 That run shows native-CPU execution on that virtual CPU; it is not physical 166 qualification. 167 - `status` is `NATIVE_PASS` only if all four commands gave their expected exit 168 and result. Otherwise use `NATIVE_FAIL` and keep the failing logs. 169 170 A physical receipt qualifies the ABI v2 boundary on that CPU model and kernel 171 only. It says nothing about CPU timing, other microarchitectures, other 172 kernels or other C libraries. 173 174 ## Checking a receipt 175 176 ```sh 177 omc < tests/native/x86/check_physical_receipt.om > check_physical_receipt 178 chmod +x check_physical_receipt 179 ./check_physical_receipt evidence/native-x86-physical-.json 180 ``` 181 182 `omc` is the seeded compiler (omega-mv `e5b32567`, sha256 ``2c824805`…`); run the 183 checker from the repository root. It reads the receipt, the four logs in 184 `evidence/native-x86-physical-/` and the pins in `tools/native`; it runs 185 nothing. It exits 0 with `PHYSICAL-RECEIPT ACCEPTED` only if the receipt is 186 `PHYSICAL`/`NATIVE_PASS` at the current `PIN` and `X86_PIN`, records host, 187 binfmt and toolchain versions, lists the four commands with their expected 188 exits and results, the log hashes match, and the suite log itself ends with 189 `NATIVE-X86 NATIVE PASS … virtualization=none`, shows 190 `INFO virtualization=none` and `INFO cpu hypervisor flag=no`, matches the 191 receipt's CPU model and kernel, and never says `EMULATED`. Any other receipt, 192 including every EMULATED receipt and an EMULATED log relabelled `PHYSICAL`, 193 exits 1 with `PHYSICAL-RECEIPT REJECTED`. Acceptance is a consistency check of 194 the receipt, not evidence by itself.