aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / AUDIT_SCOPE.md
| 1 | # Audit scope |
| 2 | |
| 3 | Written for an outside, independent security audit. Revision described: |
| 4 | `659ddd2d7e3e140cb9bf942c3171cbd9cf3d092e` on `main`, 2026-10-26. Everything below is taken from |
| 5 | the repository's own files at that revision; items marked NOT_RUN were not executed while writing |
| 6 | this document. |
| 7 | |
| 8 | ## What this repository is |
| 9 | |
| 10 | Aienux is the AienOS kernel, built to replace Linux on the NVIDIA DGX Spark. The kernel is being |
| 11 | rewritten in C (`native/`); a legacy Rust workspace (`crates/`, `Cargo.toml`) is frozen scaffolding |
| 12 | and still checked. It covers UEFI boot with image slots, the kernel, capability enforcement, |
| 13 | cryptography (signatures, M5 keyed authentication, chunked AEAD), a torn-write-safe Store, disk, |
| 14 | network and a containment component (Argus). Status (README): experimental, pre-alpha, nothing |
| 15 | physically qualified. The C kernel is IMPLEMENTED / NOT QUALIFIED; its emulator gates pass in QEMU |
| 16 | only. It has run on a Raspberry Pi 5 (2026-10-13) but has not been booted on the DGX Spark. A first |
| 17 | native boot of the earlier kernel on the DGX Spark is recorded for 2026-09-24. |
| 18 | |
| 19 | ## What to review, in priority order |
| 20 | |
| 21 | 1. Cryptographic boundaries (`native/crypto/`, `native/sig/`, `native/m5/`, |
| 22 | `crates/aienos-crypto/`, `docs/CRYPTO_CONSTANT_TIME.md`, `docs/ED25519_DEPENDENCY_REVIEW.md`). |
| 23 | AGENTS.md requires constant-time tag and key comparison, zeroization of keys and scratchpads, |
| 24 | decryption into a private scratchpad with no plaintext released before tag verification, and a |
| 25 | fixed AAD layout with no self-referential `ObjectId` or generation. |
| 26 | 2. Store and recovery (`native/store/`, `native/disk/`, `native/kernel/CONTINUITY_RECOVERY_CONTRACT.md`). |
| 27 | The three proofs (unkeyed structural integrity, keyed authentication, anti-rollback freshness) |
| 28 | must stay separate. Store v1 superblock bytes 172 to 4095 are frozen zero. |
| 29 | 3. Boot and update (`native/boot/`, `docs/NATIVE_BOOT_ROLLBACK_CONTRACT.md`, |
| 30 | `docs/NATIVE_IMAGE_SLOTS.md`, `docs/BOOT_HANDOFF_CONTRACT.md`). Slot selection, update and |
| 31 | rollback; artifact and model loading; unlock path (`efi_unlock.c`). |
| 32 | 4. Kernel (`native/kernel/`, `native/kernel/GATES.md`). Exception handling, MMU, EL0 isolation, |
| 33 | IPC, scheduling, SMMU and DMA routing (`docs/GB10_DMA_ROUTE_INVENTORY.md`). |
| 34 | 5. Capability authority (`native/capability/`, `docs/CAPABILITY_ABI.md`, |
| 35 | `scripts/cap_abi_isolation_test.sh`). The C and Rust capability ABIs must stay separate. |
| 36 | 6. Network and containment (`native/net/`, `native/argus/`). |
| 37 | 7. Owner keys (`docs/OWNER_KEY_CEREMONY.md`, `scripts/ck_owner_keys_check.sh`). |
| 38 | 8. `.github/workflows/`: `aien-verification.yml` (pull request and push, `contents: read`, trust |
| 39 | anchors from `origin/main`, builds only pinned verifier tools, verifies signed Spark bundles on |
| 40 | `alpha/*` tags) and `copilot-setup-steps.yml` (manual only, installs Rust, QEMU, AAVMF and |
| 41 | swtpm). Actions are pinned by commit sha. |
| 42 | 9. `tests/gates/run.sh` and `tests/gates/*.gate`; `scripts/ck_gates.sh`; `scripts/verify_all.sh`. |
| 43 | |
| 44 | ## Trust boundaries |
| 45 | |
| 46 | - Untrusted: disk contents (a Store may be torn, foreign or tampered), boot artifacts and update |
| 47 | images before signature verification, network input, user-mode tasks, the agent and the model |
| 48 | (README: the agent is never the root of trust and the model is never the kernel). |
| 49 | - Trusted: firmware and the hardware anti-rollback source (TPM NV counter or platform anchor), the |
| 50 | owner keys, the kernel itself, the vendored crates in `vendor/` and the Spark signing key in |
| 51 | `.aien/verify.pub`. |
| 52 | |
| 53 | ## Threat model summary |
| 54 | |
| 55 | - Assets: volume keys (`K_root_auth`, `K_vol`), Store contents and history, boot slot integrity, |
| 56 | capability state, owner identity. |
| 57 | - Attackers considered: physical tampering with storage, replay of an older authorized Store |
| 58 | history, a malicious boot or update image, a hostile user-mode task, network input. |
| 59 | - Defended (by design per AGENTS.md and docs): structural Store verification without keys, keyed |
| 60 | authentication with HMAC-SHA256 and AEAD, anti-rollback against a monotonic source, constant-time |
| 61 | comparisons, zeroization, signed boot slots with rollback, capability enforcement in the kernel. |
| 62 | - Not defended / explicitly out of scope: nothing is physically qualified; QEMU qualifies nothing |
| 63 | physical (`native/kernel/GATES.md`); side channels beyond constant-time comparison are not |
| 64 | claimed; the Rust workspace is legacy scaffolding. |
| 65 | |
| 66 | ## Build from source at a pin |
| 67 | |
| 68 | C kernel: gcc, binutils, make and a shell. Emulator gates: `qemu-system-aarch64` and AAVMF |
| 69 | (Ubuntu `qemu-system-arm`, `qemu-efi-aarch64`). Legacy Rust: a Rust toolchain with targets |
| 70 | `aarch64-unknown-uefi` and `aarch64-unknown-none`; there is no `rust-toolchain.toml`, so the exact |
| 71 | Rust version is unknown from the repository. Cargo builds offline from `vendor/` (`.cargo/config.toml`). |
| 72 | |
| 73 | Pins: `omega.lock` names omega commit `362c9ab50c8ecc3012dd2e3ac20329865ba80982` and the sha256 of |
| 74 | the vendored `native/kernel/third_party/omega/rx_cortex.c` and `rx_cortex.h`; `crumb.lock` (history only since DRA-97, 2026-11-07; no gate reads it) names |
| 75 | `d0f0b95d344b4c6628c3d868346932fd247ce168`. |
| 76 | |
| 77 | ## Run every test |
| 78 | |
| 79 | ```sh |
| 80 | make -C native/kernel test |
| 81 | make -C native/kernel sanitize |
| 82 | make -C native/capability test |
| 83 | bash scripts/cap_abi_isolation_test.sh |
| 84 | make -C native/store test mutants |
| 85 | bash scripts/ck_gates.sh |
| 86 | bash scripts/ck_pi5_build_check.sh |
| 87 | bash scripts/verify_all.sh |
| 88 | tests/gates/run.sh crypto-boundary |
| 89 | tests/gates/run.sh zero-disk-secrets |
| 90 | ``` |
| 91 | |
| 92 | Every gate is `tests/gates/run.sh <step>`; steps include `ck-host-tests`, |
| 93 | `ck-stage-tests`, `ck-gate-selftest`, `ck-hold-selftest`, `ck-owner-keys`, `ck-qemu-gates`, |
| 94 | `ck-qemu-external` (fails unless `ALLEN_MODEL`, `LOCAL_MODEL_WEIGHTS` and `LOCAL_MODEL_TOKENIZER` are given), |
| 95 | `ck-b7b-probe`, `native-net`, `native-sig`, `native-crypto`, `native-m5`, `native-disk`, |
| 96 | `native-argus`, `native-capability`, `disk-qemu`, `crypto-boundary`, `infer-crate`, |
| 97 | `store-native`, `verify-all` and `zero-disk-secrets`. Native suites must print lines such as |
| 98 | `AIENOS_CRYPTO_NATIVE: PASS`, `M5_NATIVE: PASS` and `NET_SECURE_MUTANTS: N/N killed`. |
| 99 | `scripts/ck_gates.sh` writes `evidence/ck_gates_<sha256>.json` and refuses a dirty tree; it reports |
| 100 | NOT_RUN while another gate run holds the lock. All: NOT_RUN while writing this document. |
| 101 | |
| 102 | The DGX Spark is the test judge: it runs these gates and signs a bundle. The workflow header says |
| 103 | nothing on GitHub gates a merge (2026-10-24) and GitHub checks are advisory; the README still lists |
| 104 | five required checks, so the README text and the workflow disagree. Anything that needs the real |
| 105 | DGX Spark is labelled `needs-hardware` and is NOT_RUN here. |
| 106 | |
| 107 | ## Known limitations and NOT_RUN |
| 108 | |
| 109 | - Not booted on the DGX Spark with the C kernel; physical qualification NOT_RUN. |
| 110 | - The newest committed C gate receipt covers 24 gates; `scripts/ck_gates.sh` now lists 26, so a |
| 111 | newer receipt is owed (README). |
| 112 | - `ROADMAP.md` status block is dated 2026-10-01. |
| 113 | - A head that changes `.aien/`, `tests/gates/` or `.github/workflows/` is run by the operator only |
| 114 | under the shared AIEN pipeline rules; this repository has no pipeline document of its own. |
| 115 | |
| 116 | ## Dependencies and provenance |
| 117 | |
| 118 | - Rust crates vendored in `vendor/` (including `ed25519-dalek`, `curve25519-dalek`, `sha2`, |
| 119 | `subtle`, `zeroize`, `uefi`, `serde_json`) with `Cargo.lock`. |
| 120 | - Vendored C from omega pinned by `omega.lock`. |
| 121 | - Host tools: gcc, binutils, make, QEMU, AAVMF, swtpm (copilot setup only). |
| 122 | - No Python, no CUDA, no network fetch in the build (CONTRIBUTING.md). |
| 123 | - Licence Apache-2.0 (`LICENSE`, `NOTICE`). |
| 124 | |
| 125 | ## Evidence |
| 126 | |
| 127 | - `evidence/` holds content-addressed gate receipts (`ck_gates_<sha256>.json`, |
| 128 | `trust1_m5_qualification_<sha256>.json`), QEMU logs, Raspberry Pi 5 runs |
| 129 | (`pi5_hardware_runs_2026-10-13`) and earlier DGX Spark records (`m2_first_boot_2026-09-24.md`). |
| 130 | - Signed Spark bundles: `aien-dev/aien-receipts` at `aienux/<sha>/bundle.json` (workflow path). |
| 131 | - Receipts are append-only and never edited. |