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-mv/blob/main/tools/r16_authpath.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / r16_authpath.sh` 189 lines · 10312 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # R16-G3 authoritative path without legacy orchestrators 18 # (spec/r16-orchestrator-retirement.md §5 R16-G3). 19 # 20 # Usage: tools/r16_authpath.sh 21 # mode: host | silicon 22 # R16_G3_STATIC_ONLY=1: run checks 1-3 only and report the gate NOT_RUN (CI). 23 # 24 # Checks, in order, and stops at the first failure: 25 # 1. sources: the living-system build lists only omega sources and the 26 # pinned native Aienux capability library; no omegatool, no SEQ reference 27 # loop, no Rust, nothing from aien-sovereign-core or aegis-runtime. 28 # 2. link map: neither binary defines or references a legacy orchestrator 29 # symbol (omegatool legacy_oracle / demonstration / gate runners, the SEQ 30 # pulse loop, run_until_complete, Rust-mangled or aegis/sovereign names), 31 # and neither needs a shared library beyond the C runtime. 32 # 2b. (Lane 32) the R13 binary is the PRODUCTION program: no test-build 33 # piece (AIEN_TEST_BUILD markers, Fabric loopback/HMAC stand-in, fixed 34 # test keys, composition hooks) and ARGUS linked (tools/r16_prod_hygiene.sh). 35 # 3. no legacy program name is embedded in either binary as a string. 36 # 4. exec tracing: each binary runs under strace (execve only, seccomp 37 # filter, so nothing else is slowed) with stub programs named after the 38 # legacy binaries first on PATH. Every exec must be the test itself or a 39 # helper on the allowlist (sh, rm, git: directory cleanup and the 40 # receipt's commit lookup). Any other exec, or any stub being started, 41 # fails. 42 # 5. the R13 living system and the R14 recovery run pass in that 43 # configuration (host: HOST_PASS_NON_SILICON; silicon: PASS). 44 # 45 # The world-side hooks of the SEQ reference (rx_world_init_*sequential_ 46 # reference, rx_world_seq_activate_*) are compiled into rx_world.c and are 47 # therefore present in the link map; they refuse a production world (R16-G4 48 # checks that). They are reported, not failed. The pulse loop that would drive 49 # them (rx_seq_pulse, rx_seq_run_until_complete) must be absent. 50 # 51 # Host mode never starts the graphics processor. Silicon mode is for the 52 # qualification run only: it must not be wrapped in `timeout` or killed 53 # (omega sessions rule 7), and this script never does either. 54 set -u 55 56 mode=${1:-}; r13=${2:-}; r14=${3:-}; out=${4:-} 57 if [ $# -lt 5 ] || { [ "$mode" != host ] && [ "$mode" != silicon ]; }; then 58 echo "usage: $0 host|silicon " >&2 59 exit 2 60 fi 61 shift 4 62 mkdir -p "$out" || exit 2 63 fail() { echo "R16-G3 FAIL: $*"; echo "R16 gate: R16_G3_AUTHPATH=FAIL"; exit 1; } 64 note() { echo "R16-G3 $*"; } 65 66 # 1. sources ----------------------------------------------------------------- 67 printf '%s\n' "$@" > "$out/sources.txt" 68 # Lane 32: the production program links ARGUS, extracted at the argus.lock 69 # commit into $(OUT_DIR)/argus-src//native/argus (Makefile ARGUS block). 70 argus_short=$(head -n 1 argus.lock 2>/dev/null | cut -c1-7) 71 [ -n "$argus_short" ] || fail "argus.lock is missing or empty" 72 argus_dir="*/argus-src/$argus_short/native/argus" 73 for s in "$@"; do 74 case "$s" in 75 tools/omegatool.c|*/omegatool.c) fail "source list links omegatool: $s" ;; 76 *rx_seq_reference.c) fail "source list links the SEQ reference loop: $s" ;; 77 *.rs|*sovereign*|*aegis-runtime*|*aegis_runtime*) fail "source list has a legacy Rust source: $s" ;; 78 src/*.c|src/runtime/*.c|tests/runtime/*.c) ;; 79 *libaienos_capability.a|*libaienos_capability_om2.a) ;; 80 */m16/m16_native.c|*/nvrm/nvrm.c) [ "$mode" = silicon ] || fail "physical seat source in a host build: $s" ;; 81 $argus_dir/argus_*.c) ;; # ARGUS pinned by argus.lock (git archive extract; pattern unquoted on purpose) 82 *) fail "source outside omega src/ and tests/runtime/: $s" ;; 83 esac 84 done 85 note "sources: $# files, omega, the native AIENOS capability library and ARGUS pinned by argus.lock only" 86 87 # 2. link map ---------------------------------------------------------------- 88 # Rust runtime symbols are rust_* or __rust_*, so "rust_" is matched only at a 89 # word start: a substring match also hit ARGUS trust symbols (det_trust_escalation, 90 # trust_rank_tab), which are C. Mangled Rust (_ZN, _R...) is still refused. 91 legacy_sym='legacy_oracle|run_demonstration|omega_run_m[0-9]+_gates|omega_run_m4_gates|rx_seq_pulse|rx_seq_run_until_complete|run_until_complete|^_ZN|^_R[a-zA-Z0-9]|(^|_)rust_|__rust|aegis_runtime|spark_aegis|sovereign|aien_runtime_spine|AienRuntimeSpine' 92 for b in "$r13" "$r14"; do 93 [ -x "$b" ] || fail "binary missing: $b" 94 n=$(basename "$b") 95 nm "$b" > "$out/$n.nm" 2>&1 || fail "nm failed on $b" 96 if awk '{print $NF}' "$out/$n.nm" | grep -Ei "$legacy_sym" > "$out/$n.legacy-symbols"; then 97 fail "$n links legacy orchestrator symbols: $(tr '\n' ' ' < "$out/$n.legacy-symbols")" 98 fi 99 awk '{print $NF}' "$out/$n.nm" | grep -E 'sequential_reference|rx_world_seq_' \ 100 > "$out/$n.reference-hooks" || true 101 ldd "$b" > "$out/$n.ldd" 2>&1 || fail "ldd failed on $b" 102 if grep -vE 'linux-vdso|libc\.so|libm\.so|libpthread\.so|ld-linux|libdl\.so' "$out/$n.ldd" | grep -q .; then 103 fail "$n needs a shared library outside the C runtime: $(grep -vE 'linux-vdso|libc\.so|libm\.so|libpthread\.so|ld-linux|libdl\.so' "$out/$n.ldd" | tr '\n' ' ')" 104 fi 105 note "link map $n: no legacy orchestrator symbol; C runtime libraries only; SEQ world hooks present (reference, refused on production worlds): $(wc -l < "$out/$n.reference-hooks")" 106 done 107 108 # 2b. production program (Lane 32): the R13 binary must be the production 109 # program, not the AIEN_TEST_BUILD variant: no test piece in its link map or 110 # strings, ARGUS linked (tools/r16_prod_hygiene.sh, static part only here). 111 R16_PROD_NO_RUN=1 sh tools/r16_prod_hygiene.sh "$mode" "$r13" > "$out/prod-hygiene.out" 2>&1 \ 112 || fail "the R13 binary is not the production program: $(grep -E 'FAIL' "$out/prod-hygiene.out" | head -3 | tr '\n' ' ')" 113 note "production program: $(grep -E '^R16 prod: ' "$out/prod-hygiene.out" | head -1 | sed 's/^R16 prod: //')" 114 115 # 3. embedded program names ---------------------------------------------------- 116 legacy_exe='spark-aegis|aegis-runtime|aien-cli|aien-runtime|aien-server|spark-dream|sovereign-core|omegatool' 117 for b in "$r13" "$r14"; do 118 n=$(basename "$b") 119 if strings -a "$b" | grep -E "$legacy_exe" > "$out/$n.legacy-strings"; then 120 fail "$n embeds a legacy program name: $(head -3 "$out/$n.legacy-strings" | tr '\n' ' ')" 121 fi 122 done 123 note "strings: no legacy program name embedded" 124 125 # Static-only mode (R16_G3_STATIC_ONLY=1): stop after checks 1-3. These read 126 # only the build (source list, link map, shared libraries, embedded strings) 127 # and run nothing, so they can run where the binaries cannot (a CI runner has 128 # neither the GB10 seat nor the Spark's two core classes). This is NOT the 129 # gate: checks 4-5 (exec trace and the living runs) are not run, and the gate 130 # line says NOT_RUN. 131 if [ "${R16_G3_STATIC_ONLY:-0}" = 1 ]; then 132 echo "R16-G3 static: R16_G3_LINKMAP=STATIC_PASS mode=$mode (checks 1-3 of 5 on this build; not the gate)" 133 echo "R16 gate: R16_G3_AUTHPATH=NOT_RUN (checks 4-5, exec trace and living run, not run in static-only mode)" 134 echo "R16-G3 evidence: $out" 135 exit 0 136 fi 137 138 # 4 + 5. run under exec tracing, legacy programs stubbed ------------------------ 139 stubs="$out/legacy-stubs" 140 mkdir -p "$stubs" 141 for p in spark-aegis aegis-runtime aien-cli aien-runtime aien-server spark-dream omegatool; do 142 printf '#!/bin/sh\necho "$0 $*" >> "%s/legacy-exec.log"\nexit 97\n' "$out" > "$stubs/$p" 143 chmod +x "$stubs/$p" 144 done 145 rm -f "$out/legacy-exec.log" 146 147 run_traced() { # binary tag gate-regex 148 b=$1; tag=$2; want=$3 149 PATH="$stubs:$PATH" strace --seccomp-bpf -f -qq -e trace=execve,execveat \ 150 -o "$out/$tag.exec" "$b" > "$out/$tag.out" 2>&1 151 rc=$? 152 [ $rc -eq 0 ] || fail "$tag exited $rc (log $out/$tag.out)" 153 grep -E "$want" "$out/$tag.out" > /dev/null || fail "$tag did not print its gate line ($want)" 154 grep -oE 'execve(at)?\([^"]*"[^"]*"' "$out/$tag.exec" | sed 's/.*"\(.*\)"/\1/' \ 155 | sort | uniq -c > "$out/$tag.exec-summary" 156 self=$(basename "$b") 157 bad=$(awk '{print $2}' "$out/$tag.exec-summary" | while read -r e; do 158 case "$(basename "$e")" in 159 "$self"|sh|rm|git) ;; 160 *) echo "$e" ;; 161 esac 162 done) 163 [ -z "$bad" ] || fail "$tag exec'd programs outside the allowlist: $bad" 164 [ ! -s "$out/legacy-exec.log" ] || fail "a legacy program stub was started: $(cat "$out/legacy-exec.log")" 165 note "exec trace $tag: $(awk '{printf "%s x%s, ", $2, $1}' "$out/$tag.exec-summary")no legacy exec" 166 } 167 168 if [ "$mode" = host ]; then 169 r13_want='R13 gate: R13_LIVING_SYSTEM=HOST_PASS_NON_SILICON' 170 r14_want='R14 gate: R14_LIVING_RECOVERY=HOST_PASS_NON_SILICON' 171 else 172 r13_want='R13 gate: R13_LIVING_SYSTEM=PASS' 173 r14_want='R14 gate: R14_LIVING_RECOVERY=PASS' 174 fi 175 run_traced "$r13" r13 "$r13_want" 176 grep -E '^R13 (gate|costs|control E episode|ARGUS):' "$out/r13.out" | sed 's/^/R16-G3 /' 177 grep -q '^R13 ARGUS: observing' "$out/r13.out" || fail "R13 did not report ARGUS observing" 178 run_traced "$r14" r14 "$r14_want" 179 grep -E '^R14 [A-F]_[a-z_]+ +(PASS|FAIL)|^R14 gate:' "$out/r14.out" | sed 's/^/R16-G3 /' 180 if grep -E '^R14 [A-F]_[a-z_]+ +FAIL' "$out/r14.out" > /dev/null; then 181 fail "an R14 recovery part failed" 182 fi 183 184 if [ "$mode" = host ]; then 185 echo "R16 gate: R16_G3_AUTHPATH=HOST_PASS_NON_SILICON (host stand-in seat; the gate needs the silicon run)" 186 else 187 echo "R16 gate: R16_G3_AUTHPATH=PASS" 188 fi 189 echo "R16-G3 evidence: $out"