atlas
aien-dev/atlas
Brought by drakestapleton
atlas / AUDIT_SCOPE.md
| 1 | # Audit scope |
| 2 | |
| 3 | Written for an outside, independent security audit. Revision described: |
| 4 | `c624eb489275bc046cec3686af3010b8dcc7eec0` on `master`, 2026-10-26. Everything below is taken from the repository's own files at |
| 5 | that revision; items marked NOT_RUN were not executed while writing this document. |
| 6 | |
| 7 | ## What this repository is |
| 8 | |
| 9 | Atlas is the first software in the AIEN boot chain: a 1,480-byte AArch64 binary, `atlas.bin` |
| 10 | (SHA-256 `f7802501b410a0c19eff7b8fca8865c9ba9c96bfa4f8065ca8f508b67748b9a5`), that checks the next |
| 11 | boot stage against a pinned SHA-256 digest |
| 12 | (`e1d89bb1e0854ebaccd2be5c756c8a2ff8c5ecc8c0f90b4abd461fb7bf98374c`), hands control to it, and |
| 13 | refuses and halts if the check fails. Its source is `atlas.s`. The repository also holds its audit |
| 14 | artifacts, `machine_contract.json` (`CONTRACT-QEMU-VIRT-AARCH64-M1`), the Milestone 1 receipt |
| 15 | `qualification_receipt.json`, a 256-byte test payload `physics-0.bin` (source `physics_0.s`), and a |
| 16 | C and POSIX shell gate runner. Status: QEMU qualified, native run pending, quiet (the seed and its |
| 17 | gate runner last changed on 2026-09-26). Licence Apache 2.0. |
| 18 | |
| 19 | ## What to review, in priority order |
| 20 | |
| 21 | 1. `atlas.s` and `atlas.bin`. The seed: masks interrupts, sets the stack at `0x401FC000`, writes |
| 22 | a boot descriptor at `0x401FE000`, hashes the payload, compares with the pinned digest, and |
| 23 | either branches to `0x40200000` (`ldr x19, =0x40200000; br x19`) or halts. Check the compare is |
| 24 | over the full digest, that the hashed range equals the executed range, and that every failure |
| 25 | path reaches the halt. |
| 26 | 2. `sha256_clean.s` and `sha256_clean.c`. The SHA-256 used by the seed and by the host tools. |
| 27 | `test_sha256_kat.c` runs NIST FIPS 180-4 known-answer tests against the C implementation. |
| 28 | 3. `atlas.memory-map`, `atlas.control-flow`, `atlas.audit`, `atlas.decode`, `atlas.manifest`, |
| 29 | `machine_contract.json`. Static descriptions that Seam 1 checks against the binary (301 |
| 30 | instructions, 69 rodata words, 0 discrepancy; 8 KiB guard gap between stack and descriptor). |
| 31 | Check they describe the binary, not each other. |
| 32 | 4. `tools/m1tool.c` (1,150 lines). Host tool: `sha256`, `hexfield`, `bytes`, `audit-verify`, |
| 33 | `gen-audit`, `mutate-sweep`, `mutate-adv`, `qemu-run`, `qemu-matrix`. It parses the audit and |
| 34 | decode text files, forks `aarch64-linux-gnu-objdump` (in `gen-audit`) and |
| 35 | `qemu-system-aarch64 -M virt` (in `qemu-run` and `qemu-matrix`) with `execvp`/`execlp`, kills |
| 36 | QEMU after a timeout (default 1500 ms), and writes mutated payloads into a `mkdtemp` directory. |
| 37 | Check parser bounds, argument handling and temporary file safety. |
| 38 | 5. `run_m1_gates.sh`. Builds the host tools with `gcc -O2 ... -Werror`, runs the KAT, Seam 1 and |
| 39 | Seam 2 under `set -eu`. Note that the final summary prints fixed `[PASSED]` lines; it relies on |
| 40 | `set -e` stopping the script when any earlier step fails. With `--write-receipt` it overwrites |
| 41 | `qualification_receipt.json`. |
| 42 | 6. `scripts/test-host-security.sh`. Offline host-only controls: builds `m1tool` with |
| 43 | AddressSanitizer and UndefinedBehaviorSanitizer, feeds malformed decode offsets, checks that an |
| 44 | artifact path is not interpreted by a shell, that a symlink at a predictable temp name is not |
| 45 | clobbered, and that a failing KAT stops the runner with its exit status. |
| 46 | 7. `scripts/check-no-python.sh`. Fails on any tracked Python file or Python shebang. |
| 47 | |
| 48 | There is no `.github/workflows/` directory. AGENTS.md: "There is no hosted CI. Testing runs on the |
| 49 | project's own machines; GitHub-hosted test workflows were removed on purpose." |
| 50 | |
| 51 | ## Trust boundaries |
| 52 | |
| 53 | - Seed input: the next-stage payload in memory at boot. Untrusted until its digest matches. |
| 54 | - Trusted at boot: the pinned digest embedded in `atlas.bin`, and whatever firmware loads Atlas. |
| 55 | - Host tooling input: the committed artifact files and command-line paths given to `m1tool`. |
| 56 | - Trusted host oracles: `gcc`, `qemu-system-aarch64`, `aarch64-linux-gnu-objdump` (for |
| 57 | `gen-audit` only). |
| 58 | |
| 59 | ## Threat model summary |
| 60 | |
| 61 | - Assets: boot integrity (only the pinned next stage runs); honesty of the qualification receipt. |
| 62 | - Attackers considered: a corrupted or substituted next-stage payload (256 single-byte mutations |
| 63 | and 12 structured mutations are tested); a malformed audit or decode file; a hostile path argument; |
| 64 | a predictable temporary file. |
| 65 | - Defended: digest check with fail-closed halt; Seam 1 static reconciliation; Seam 2 corruption |
| 66 | matrix (268 of 268 refused per the receipt); host sanitizer controls. |
| 67 | - Not defended / explicitly out of scope: QEMU qualification is not native qualification; |
| 68 | `ATLAS_BOOT_NATIVE_PASS` needs a physical NVIDIA DGX Spark and has no runner here. Firmware below |
| 69 | Atlas is out of scope. No constant-time claim is made for the SHA-256 comparison. |
| 70 | |
| 71 | ## Build from source at a pin |
| 72 | |
| 73 | Requirements (AGENTS.md): a POSIX shell, `gcc`, `git`, and `qemu-system-aarch64` (machine `virt`) |
| 74 | for the execution seam. No Python and no package manager. `gen-audit` also needs |
| 75 | `aarch64-linux-gnu-objdump`. Toolchain versions are not pinned in the repository. |
| 76 | |
| 77 | The host tools are built by the gate runner: |
| 78 | |
| 79 | ```sh |
| 80 | gcc -O2 -std=c11 -Wall -Wextra -Werror -o tools/m1tool tools/m1tool.c sha256_clean.c |
| 81 | gcc -O2 -o test_sha256_kat test_sha256_kat.c sha256_clean.c |
| 82 | ``` |
| 83 | |
| 84 | The command that assembles `atlas.s` into `atlas.bin` is unknown from the repository; the committed |
| 85 | `atlas.bin` is the canonical artifact, identified by `atlas.sha256`. |
| 86 | |
| 87 | ## Run every test |
| 88 | |
| 89 | NOT_RUN while writing this document. In order: |
| 90 | |
| 91 | ```sh |
| 92 | sh scripts/check-no-python.sh # no tracked Python |
| 93 | sh scripts/test-host-security.sh # host-only sanitizer and fail-closed controls, no QEMU |
| 94 | ./run_m1_gates.sh # KAT, Seam 1, Seam 2 (needs qemu-system-aarch64) |
| 95 | ``` |
| 96 | |
| 97 | Expected summary lines: `ATLAS-HOST-SECURITY PASS (sanitizer bounds, argv, private temp, failed |
| 98 | KAT)` from the host-security script, and `Overall Result: MILESTONE 1 QUALIFIED (QEMU)` followed by |
| 99 | the eight gate names from `run_m1_gates.sh`. Do not pass `--write-receipt`: it overwrites the |
| 100 | committed receipt and is reserved for an approved requalification. `run_milestone1_gates.sh` is the |
| 101 | same runner under its old name. Native hardware gates: NOT_RUN, no runner exists. |
| 102 | |
| 103 | ## Known limitations and NOT_RUN |
| 104 | |
| 105 | - Native DGX Spark qualification pending (`native_hardware_qualification_status`: |
| 106 | `PENDING_SEPARATE_NATIVE_GATES` in the receipt). |
| 107 | - The seed assembly command is not recorded. |
| 108 | - `TRANSITION_PLAN_M1.md`: the committed `qualification_receipt.json` "remains untouched as |
| 109 | historical evidence for the Python-based qualification". A refreshed receipt from the C and shell |
| 110 | runner is generated only when the requalification decision is recorded in `aien-architecture#12`. |
| 111 | - The runner's summary lines are static text gated by `set -e`. |
| 112 | - `physics-0.bin` is a test payload; the real next stage is in `aien-dev/physics`. |
| 113 | |
| 114 | ## Dependencies and provenance |
| 115 | |
| 116 | - No lockfile and no package dependencies. `sha256_clean.c` is in-tree. |
| 117 | - Host tools: gcc, QEMU, binutils objdump, POSIX shell; versions unpinned. |
| 118 | - No network access at build or test time is required by the scripts. |
| 119 | - No GitHub Actions. |
| 120 | - `HISTORICAL-PYTHON.md` explains how the removed Python scripts can be retrieved from history. |
| 121 | |
| 122 | ## Evidence |
| 123 | |
| 124 | `qualification_receipt.json` is the Milestone 1 receipt. `history/alpha/` holds pre-rename |
| 125 | artifacts. AGENTS.md: historical evidence is not edited to match today's standards; do not modify |
| 126 | the receipt, the seed or its pins without an explicit maintainer decision. Receipts are append-only. |