physics-mv
FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.
Brought by drakestapleton
GitHub aien-dev/physics-mv#88 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/physics-mv/patches/fc1e726a9f60141a.bundle -o fc1e726a9f60141a.bundle git fetch fc1e726a9f60141a.bundle refs/pull/88/head
Provenance
github-import 1
aien-dev/physics-mv
88
22ebe6fad9d545f954ddacd901e8e9ac6e7e3735
{"kind":"github-import","owner":"aien-dev","repo":"physics-mv","number":88,"url":"https://github.com/aien-dev/physics-mv/pull/88","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:30Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml index 0136783..cba26ba 100644 --- a/.github/workflows/aien-verification.yml +++ b/.github/workflows/aien-verification.yml @@ -82,23 +82,28 @@ jobs: ref: ${{ env.AIEN_TEST_PIN }} path: .aien-test-src - - name: Cache the pinned aien-test build + - name: Move the pinned source outside the candidate Cargo configuration + if: steps.anchors.outputs.enrolled == 'true' + run: mv .aien-test-src "$RUNNER_TEMP/aien-test-src" + + # Cache dependencies only, never verifier executables or candidate-controlled target output. + - name: Cache the pinned aien-test dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 if: steps.anchors.outputs.enrolled == 'true' with: path: | ~/.cargo/registry ~/.cargo/git - .aien-test-src/target - key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }} + key: aien-test-isolated-v1-${{ runner.os }}-${{ env.AIEN_TEST_PIN }} - - name: Build aien-test from the pin (never from the tree under test), then remove the source + - name: Build aien-test outside the tree under test if: steps.anchors.outputs.enrolled == 'true' run: | - cargo build --release -p aien-test --manifest-path .aien-test-src/Cargo.toml - mkdir -p "$RUNNER_TEMP/bin" && cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test" + cd "$RUNNER_TEMP/aien-test-src" + cargo build --release -p aien-test --target-dir "$RUNNER_TEMP/aien-test-target" + mkdir -p "$RUNNER_TEMP/bin" && cp "$RUNNER_TEMP/aien-test-target/release/aien-test" "$RUNNER_TEMP/bin/aien-test" echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" - rm -rf .aien-test-src + cd "$GITHUB_WORKSPACE" git status --porcelain --untracked-files=normal - name: Portable smoke set (gates whose requires is only portable, named at the base ref) @@ -172,21 +177,25 @@ jobs: ref: ${{ env.AIEN_TEST_PIN }} path: .aien-test-src - - name: Cache the pinned aien-test build + - name: Move the pinned source outside the candidate Cargo configuration + run: mv .aien-test-src "$RUNNER_TEMP/aien-test-src" + + # Cache dependencies only, never verifier executables or candidate-controlled target output. + - name: Cache the pinned aien-test dependencies uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | ~/.cargo/registry ~/.cargo/git - .aien-test-src/target - key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }} + key: aien-test-isolated-v1-${{ runner.os }}-${{ env.AIEN_TEST_PIN }} - - name: Build aien-test from the pin (never from the tree under test), then remove the source + - name: Build aien-test outside the tree under test run: | - cargo build --release -p aien-test --manifest-path .aien-test-src/Cargo.toml - mkdir -p "$RUNNER_TEMP/bin" && cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test" + cd "$RUNNER_TEMP/aien-test-src" + cargo build --release -p aien-test --target-dir "$RUNNER_TEMP/aien-test-target" + mkdir -p "$RUNNER_TEMP/bin" && cp "$RUNNER_TEMP/aien-test-target/release/aien-test" "$RUNNER_TEMP/bin/aien-test" echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" - rm -rf .aien-test-src + cd "$GITHUB_WORKSPACE" git status --porcelain --untracked-files=normal - name: Fetch the signed Spark bundle for the tagged commit diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9cd4fdb..60691da 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -14,6 +14,7 @@ Every model below did real work. A model is listed only for work it did. The orc | Codex | Code review of the Gate 3/4 receipt writer: one finding (binaries were hashed after the GPU lock was released), fixed | | Grok | Code review of the Gate 3/4 receipt writer: three findings (empty binary hash on PASS, blobs symlink, existing blob mode), fixed | | Gemini | Code review of the Gate 3/4 receipt writer (no findings) | +| OpenAI Codex GPT-6 Sol | M2 host verifier literal bounds and argv execution, private qualification output, and the historical M16 checksum-path provenance mapping | | OpenAI GPT-6.1 Sol | Current HDAE development wording and Gregory M. Kurtzer citation in README and contributor guidance (2026-10-28); no implementation or historical receipt changes | | Grok 4.7 | README alignment with ADR 0045: this repository is part of Sovereign Intelligence (SI). SI's repository index lists it under "CUDA++ runtime" ([ADR 0045](https://github.com/aien-dev/aien-architecture-mv/blob/f13c6238e585b284a87e7f5b227f7f8a1bc6bef7/docs/adr/0045-aienix-retired-sovereign-intelligence-center.md)) (2026-10-30) | diff --git a/README.md b/README.md index 65f4edf..3d3d52f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Since 2026-10-16 the DGX Spark is the only test judge for pull requests (aien-ar - `evidence/m16-blackwell-native-path-receipt.json` still says `QUALIFIED / PASS`. It is the original M16 receipt (commit `f72e297`) and it is superseded: it failed an independent runtime audit (it linked `libcuda`, reused stale session state, and cited raw evidence that was never committed). Do not cite it as a qualification. Its own requalification record is `evidence/m16-blackwell-native-path-requalification-receipt.json` with the audit in `evidence/m16-requalification/M16_REQUALIFICATION_AUDIT.md` (implementation `a2c0d7f`). Evidence files are add-only, so the original receipt is left unchanged on purpose. - Even the requalification binds the code of its own time. It is historical evidence, not a claim about the current candidate. Source: `reports/L2-EVID.md` of the 2026-10-05 candidate audit (CAND-0 physics pin `6d7cf0d`), as cited in aien-architecture `doctrine/ROADMAP.md`. +- The original M16 requalification `SHA256SUMS` records eight absolute paths from a historical checkout. The additive [provenance map](evidence/m16-requalification/PROVENANCE-MAP.md) resolves those checksum entries against their historical Git pins. Its empty `build.log` does not record compiler output or prove a fresh build. ## Contributing diff --git a/evidence/m16-requalification/PROVENANCE-MAP.md b/evidence/m16-requalification/PROVENANCE-MAP.md new file mode 100644 index 0000000..cee278c --- /dev/null +++ b/evidence/m16-requalification/PROVENANCE-MAP.md @@ -0,0 +1,41 @@ +# M16 historical checksum-path map (2026-10-26) + +This is an **additive path interpretation**, not a new qualification, source +rebuild, or correction to the retained receipt. `SHA256SUMS` and `build.log` +remain byte-for-byte historical evidence. Its first eight absolute paths +refer to the old `m17-physics` checkout. The implementation source was pinned +at `a2c0d7fbc03f7ce91fcb6389312a0ee8630322cd`; the receipt first appeared +in the later evidence commit `b64753d`. The mapping below was checked by +hashing `git show <pin>:<relative-path>` for the first seven rows and the +retained receipt bytes for the eighth. No original checkout is required. + +| Original `SHA256SUMS` suffix | Repository-relative path | Pin | Recorded SHA-256 | +| --- | --- | --- | --- | +| `m16/m16_native.h` | `m16/m16_native.h` | `a2c0d7f` | `2840151393f7292e2d1b74c4510f813ca5754877e5df40d1d7afca15987f42b8` | +| `m16/m16_native.c` | `m16/m16_native.c` | `a2c0d7f` | `1b00fd6f6a50bce45bcfb7a8f7b621b699f930557b92b6acb6019b0a4fa518d5` | +| `m16/m16_requalify.c` | `m16/m16_requalify.c` | `a2c0d7f` | `af50f8225930565edbce9d1dd668fab235a59f4b779610d63d1e1767051b5320` | +| `m16/m16_concurrent.c` | `m16/m16_concurrent.c` | `a2c0d7f` | `27c532db479abdf372d1400c049a3fb07bd7ae46e213645e781a3c736ead04b8` | +| `nvrm/nvrm.h` | `nvrm/nvrm.h` | `a2c0d7f` | `1885d5daa862e18b76ca68a5613d8c4b115b6915f4bb2d1d4f98cea49e5287fd` | +| `nvrm/nvrm.c` | `nvrm/nvrm.c` | `a2c0d7f` | `6976b1ead456daf421e7fd0dd6fbb344a91248b5a86207ca023e25ec9a2435a3` | +| `tests/run_m16_requalification.sh` | `tests/run_m16_requalification.sh` | `a2c0d7f` | `4684d4886f398f6f05f93eeb206b521d27f2fcecf44ee234c778c7fd760a0a16` | +| `evidence/m16-blackwell-native-path-requalification-receipt.json` | same relative path | `b64753d` | `1a32cc2e04793d9fa86849bb93a51145f5b62fea4a8d70484c6a3fccdcbc3b56` | + +To check one source row, from any clone of this repository (`a2c0d7f` is on no +branch, so first `git fetch origin a2c0d7fbc03f7ce91fcb6389312a0ee8630322cd`): + +```sh +git show a2c0d7fbc03f7ce91fcb6389312a0ee8630322cd:m16/m16_native.h | sha256sum +``` + +To check the receipt row, substitute +`b64753d:evidence/m16-blackwell-native-path-requalification-receipt.json`. +The remaining entries in `SHA256SUMS` name files relative to +`evidence/m16-requalification/` and are not remapped. The retained +`build.log` has SHA-256 +`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`: +it is empty, not a transcript of compiler invocation/version/output. The +historical script contains GCC command lines at +`tests/run_m16_requalification.sh:42-60`, and the receipt records a GCC +version, but neither substitutes for an observed build transcript. This map +establishes portability of the eight checksum references only; it does not +re-exercise hardware or qualify the current source revision. diff --git a/run_m2_gates.sh b/run_m2_gates.sh index 697ae93..ab1b65f 100755 --- a/run_m2_gates.sh +++ b/run_m2_gates.sh @@ -26,6 +26,7 @@ # Rule adherence (tracking aien-architecture#12, physics#8): # Existing qualification_receipt.json is preserved intact unless --write-receipt is passed. set -eu +umask 077 REPO_DIR=$(cd "$(dirname "$0")" && pwd -P) cd "$REPO_DIR" @@ -56,9 +57,10 @@ M2TOOL="$REPO_DIR/tools/m2tool" QEMU_INSPECT="$REPO_DIR/tools/qemu_inspect.sh" BUILD_DIR="$REPO_DIR/build" CANON="$BUILD_DIR/canonical" -RUN_DIR="/tmp/m2_gate_qualification_$$" -mkdir -p "$RUN_DIR" -trap 'rm -rf "$RUN_DIR"' EXIT INT TERM +RUN_DIR=$(mktemp -d "${TMPDIR:-/tmp}/m2_gate_qualification_XXXXXXXX") || exit 1 +chmod 700 "$RUN_DIR" +trap 'rm -rf -- "$RUN_DIR"' EXIT +trap 'exit 1' INT TERM # 1. Run Seam 1 (Artifact Audit Seam) echo "" diff --git a/tests/test_m2_host_security.sh b/tests/test_m2_host_security.sh new file mode 100755 index 0000000..b31c8f5 --- /dev/null +++ b/tests/test_m2_host_security.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# Offline M2 host-verifier tests; no GPU, QEMU, receipt or historical edits. +set -eu +ROOT=$(cd "$(dirname "$0")/.." && pwd -P) +T=$(mktemp -d "${TMPDIR:-/tmp}/physics-host-security.XXXXXXXX") +trap 'rm -rf "$T"' EXIT +trap 'exit 1' INT TERM +: "${CC:=gcc}" +"$CC" -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -std=c11 -Wall -Wextra -Werror \ + -o "$T/m2tool" "$ROOT/tools/m2tool.c" "$ROOT/sha256_clean.c" +export ASAN_OPTIONS=detect_leaks=0 + +audit() { + "$T/m2tool" audit-verify "$ROOT/physics.bin" "$ROOT/physics.sha256" \ + "$ROOT/physics.manifest" "$ROOT/machine_contract.json" "$ROOT/physics.audit" "$1" +} +audit "$ROOT/physics.decode" > "$T/golden.log" +sed 's/ldr[[:space:]]x10, 40200280/ldr\tx10, fffffffffffffffc/' \ + "$ROOT/physics.decode" > "$T/bad.decode" +grep -q fffffffffffffffc "$T/bad.decode" +if audit "$T/bad.decode" > "$T/bad.log" 2>&1; then + echo 'unexpected PASS: wrapping literal address' >&2; exit 1 +fi +grep -q 'FAIL: SP literal' "$T/bad.log" +if grep -q AddressSanitizer "$T/bad.log"; then + echo 'sanitizer abort: literal address' >&2; exit 1 +fi + +aarch64-linux-gnu-gcc -c -nostdlib "$ROOT/physics.s" -o "$T/physics.o" +"$T/m2tool" get-symbol "$T/physics.o" _physics_entry > "$T/symbol.log" +grep -q '^0x' "$T/symbol.log" +marker="$T/shell-marker" +if "$T/m2tool" get-symbol "missing; touch $marker; #" _physics_entry > "$T/injection.log" 2>&1; then + echo 'unexpected PASS: nonexistent object' >&2; exit 1 +fi +[ ! -e "$marker" ] || { echo 'shell interpreted object path' >&2; exit 1; } + +mkdir "$T/public" +chmod 777 "$T/public" +if QEMU=/bin/true "$ROOT/tools/qemu_inspect.sh" --out "$T/public" --marker READY \ + > "$T/inspect.log" 2>&1; then + echo 'inspector accepted publicly writable output' >&2; exit 1 +fi +grep -q 'output directory is not private' "$T/inspect.log" +ln -s "$T/public" "$T/symlink" +if QEMU=/bin/true "$ROOT/tools/qemu_inspect.sh" --out "$T/symlink" --marker READY \ + > "$T/symlink.log" 2>&1; then + echo 'inspector accepted output symlink' >&2; exit 1 +fi +grep -q 'output directory must not be a symlink' "$T/symlink.log" + +# The historical checksum file stays immutable; each absolute path resolves +# against the original source or receipt commit, not today's working tree. +# a2c0d7f is not on any branch, so a default clone lacks it: fetch it by sha. +# A pin that still cannot be read fails below as a digest mismatch. +for pin in a2c0d7fbc03f7ce91fcb6389312a0ee8630322cd b64753d95bacb1114ba48decde48239f0c542e12; do + git -C "$ROOT" cat-file -e "$pin^{commit}" 2>/dev/null || git -C "$ROOT" fetch -q origin "$pin" || true +done +n=0 +while read -r digest historical; do + case $historical in + /home/*/workspace/m17-physics/*) + relative=${historical#*/workspace/m17-physics/} + case $relative in + evidence/*) pin=b64753d95bacb1114ba48decde48239f0c542e12 ;; + *) pin=a2c0d7fbc03f7ce91fcb6389312a0ee8630322cd ;; + esac + actual=$(git -C "$ROOT" show "$pin:$relative" | sha256sum) + [ "${actual%% *}" = "$digest" ] || { echo "historical digest mismatch: $relative" >&2; exit 1; } + n=$((n + 1)) ;; + esac +done < "$ROOT/evidence/m16-requalification/SHA256SUMS" +[ "$n" -eq 8 ] || { echo "historical path count changed: $n" >&2; exit 1; } +printf 'PHYSICS-HOST-SECURITY PASS (sanitizer bounds, argv, private output refusal, M16 provenance)\n' diff --git a/tools/m2tool.c b/tools/m2tool.c index 0da23ba..06ac73c 100644 --- a/tools/m2tool.c +++ b/tools/m2tool.c @@ -31,6 +31,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> +#include <sys/wait.h> void sha256_compute(const uint8_t *data, uint64_t len, uint8_t scratch_buf[128], uint32_t out_digest[8]); @@ -75,6 +76,17 @@ static int parse_u64(const char *s, uint64_t *v) { return 0; } +static int parse_literal(const char *s, uint64_t *value) { + if (!isxdigit((unsigned char)*s)) return 0; + char *end; + errno = 0; + unsigned long long parsed = strtoull(s, &end, 16); + if (errno || end == s || (*end && *end != ' ' && *end != '\t' && + *end != '<' && *end != '\n')) return 0; + *value = parsed; + return 1; +} + static void put_hex(const uint8_t *p, uint64_t n) { for (uint64_t i = 0; i < n; i++) printf("%02x", p[i]); } @@ -647,8 +659,10 @@ static int cmd_audit_verify(int argc, char **argv) { if (comma) { const char *lit = comma + 1; while (*lit == ' ' || *lit == '\t') lit++; - uint64_t lit_addr = strtoull(lit, NULL, 16); - if (lit_addr >= 0x40200000 && lit_addr + 8 <= 0x40200000 + bin_sz) { + uint64_t lit_addr = 0; + if (parse_literal(lit, &lit_addr) && lit_addr >= 0x40200000 && + lit_addr - 0x40200000 <= bin_sz && + bin_sz - (lit_addr - 0x40200000) >= 8) { uint64_t offset = lit_addr - 0x40200000; uint64_t sp_val = 0; for (int i = 0; i < 8; i++) sp_val |= (uint64_t)bin_buf[offset + i] << (8 * i); @@ -659,8 +673,17 @@ static int cmd_audit_verify(int argc, char **argv) { printf(" FAIL: Unexpected SP value 0x%08llx\n", (unsigned long long)sp_val); disjoint_ok = 0; } + } else { + printf(" FAIL: SP literal outside binary or malformed\n"); + disjoint_ok = 0; } + } else { + printf(" FAIL: SP literal operand missing\n"); + disjoint_ok = 0; } + } else { + printf(" FAIL: SP setup missing from decode\n"); + disjoint_ok = 0; } printf(" Static Access Bounds: All MMIO writes target PL011 (0x09000000) or stack/tables [OK]\n"); @@ -1066,23 +1089,49 @@ static int cmd_verify_no_auth(int argc, char **argv) { static int cmd_get_symbol(int argc, char **argv) { if (argc != 3) return fail("usage: %s <elf_file> <symbol_name>", argv[0]); - char cmd[512]; - snprintf(cmd, sizeof(cmd), "aarch64-linux-gnu-nm %s", argv[1]); - FILE *p = popen(cmd, "r"); - if (!p) return fail("cannot run nm on %s", argv[1]); + int pipefd[2]; + if (pipe(pipefd) < 0) return fail("cannot create nm pipe"); + pid_t pid = fork(); + if (pid < 0) { + close(pipefd[0]); close(pipefd[1]); + return fail("cannot fork nm"); + } + if (pid == 0) { + close(pipefd[0]); + if (dup2(pipefd[1], STDOUT_FILENO) < 0) _exit(127); + close(pipefd[1]); + execlp("aarch64-linux-gnu-nm", "aarch64-linux-gnu-nm", + "--", argv[1], (char *)NULL); + _exit(127); + } + close(pipefd[1]); + FILE *p = fdopen(pipefd[0], "r"); + if (!p) { + close(pipefd[0]); + int status; + while (waitpid(pid, &status, 0) < 0 && errno == EINTR) {} + return fail("cannot read nm output"); + } char line[256]; + char found[64] = ""; while (fgets(line, sizeof(line), p)) { char addr_s[64], type_s[16], name_s[128]; - if (sscanf(line, "%63s %15s %127s", addr_s, type_s, name_s) == 3) { - if (strcmp(name_s, argv[2]) == 0) { - pclose(p); - printf("0x%s\n", addr_s); - return 0; - } + if (sscanf(line, "%63s %15s %127s", addr_s, type_s, name_s) == 3 && + strcmp(name_s, argv[2]) == 0) { + snprintf(found, sizeof(found), "%s", addr_s); } } - pclose(p); - return fail("symbol %s not found in %s", argv[2], argv[1]); + int read_error = ferror(p); + fclose(p); + int status; + while (waitpid(pid, &status, 0) < 0) { + if (errno != EINTR) return fail("cannot wait for nm"); + } + if (read_error || !WIFEXITED(status) || WEXITSTATUS(status) != 0) + return fail("nm failed on %s", argv[1]); + if (!*found) return fail("symbol %s not found in %s", argv[2], argv[1]); + printf("0x%s\n", found); + return 0; } static const struct { diff --git a/tools/qemu_inspect.sh b/tools/qemu_inspect.sh index 24ea740..851de87 100755 --- a/tools/qemu_inspect.sh +++ b/tools/qemu_inspect.sh @@ -58,8 +58,12 @@ to_dec() { # strict unsigned number -> decimal; empty on error printf '%d' "$1" } +umask 077 +[ ! -L "$OUT" ] || die "output directory must not be a symlink" mkdir -p "$OUT" OUT=$(cd "$OUT" && pwd -P) +[ "$(stat -c %u "$OUT")" = "$(id -u)" ] || die "output directory is not owned by caller" +[ -z "$(find "$OUT" -maxdepth 0 -perm /077 -print)" ] || die "output directory is not private" SOCK=$OUT/qmp.sock rm -f "$OUT/serial.txt" "$OUT/qmp.log" "$SOCK"