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/aienux/patches/dbc6dd8af1318482 # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aienux#391 (code only) closed derived `dbc6dd8af1318482` #391 Imported from GitHub aien-dev/aienux#391 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `77514f7ef96cf09fa0149e81951398e8e3608ee5` · Head `712520bc0578593e27b36cca6813dc8f87970a0e` drakestapleton reviewed (COMMENTED) on 2026-10-30 11:18 UTC Triage: needs-changes (merge conflicts with `main`) Test-only and security-positive: it exercises the launch-time executable rehash (CODE_HASH_MISMATCH). Please make sure the TEST-ONLY byte-flip variant cannot be compiled into production images (a build flag guard plus a check). To be merge-ready: rebase and pass checks. drakestapleton reviewed (COMMENTED) on 2026-10-30 12:07 UTC Guard review at `d288a845`: COMMENT only. Guard is sound for Makefile builds; not proven in CI. I read the PR diff, `native/kernel/Makefile` and `native/kernel/core/osc_admit.c` at this head, and the CI workflows. I did not build anything locally. Per-layer findings follow. Layer 1: Makefile `$(error)` (`Makefile` L871-886). Blocks the flag when CK_OSC_RECEIPT_TEST is set as a make variable. - When `CK_OSC_RECEIPT_TEST=1`, make refuses to start if any of these hold: `CK_HARDWARE_STAGING` is non-empty (L873), `CK_SERVICE` is non-empty (L876), or `CK_SEED0B_TEST_ANCHOR` is empty, which means a release build (L879). Staging also can't carry the TEST anchor (L846-848), and `CK_SERVICE` must be empty or 1 (L679-680), so these checks are consistent. - Only `"1"` turns the flag on (L872). Any other value adds no `-D` and fails safe. - Bypass: this layer never sees `CK_EXTRA_CFLAGS=-DCK_OSC_RECEIPT_TEST=1`, because that gets into `KCFLAGS` at L926. It also never sees a compiler command that doesn't go through make. Layers 2 and 3 are meant to cover those. Layer 2: `#error` (`osc_admit.c` L50-58). Works for staging and service builds that use the Makefile. Its release check depends on a make-supplied define. - Staging and service: the `osc_admit.o` rule now passes `-DCK_HARDWARE_STAGING=1` and `-DCK_SERVICE=1` (L1161). They come after `$(KCFLAGS)`, so a `-U` in `CK_EXTRA_CFLAGS` can't undo them. A `-DCK_OSC_RECEIPT_TEST` injected through `CK_EXTRA_CFLAGS` into a staging or service build therefore fails to compile. - Release: the check is `!defined(CK_SEED0B_TEST_ANCHOR)`. Anyone who adds both `-DCK_OSC_RECEIPT_TEST` and `-DCK_SEED0B_TEST_ANCHOR` gets past it. Adding the anchor also switches the trust root to the TEST key (`osc_admit.c` L119-132), so that image could not pass as a production image, but this layer does not stop it. - Hand-written compiler command: nothing defines `CK_HARDWARE_STAGING` or `CK_SERVICE` outside this Makefile rule (and the stage-source flags at L1007), so a command that skips the Makefile gets past the staging and service checks. Layer 3: link-time check `osc_rehash_check` (`Makefile` L1346-1359, called at L1389 for `$(ELF)` and L1405 for `$(FULL_ELF)`). This is the real backstop for `make all` and `make full`. - When the make variable is not 1, the link fails and the ELF is deleted if the image contains the symbol (`nm`, matches the local `t` symbol) or the banner string (`grep -a`). This catches the `CK_EXTRA_CFLAGS` route. - The banner `printf` (`osc_admit.c` L395) and the flip function (L273-280) are both inside `#ifdef CK_OSC_RECEIPT_TEST`, so either one is a reliable marker. - Limits: - `$(EFI)` and `$(FULL_EFI)` are built only from checked ELFs (L1407, L1410), but the check is not re-run on the PE itself. - Only these two link rules have the check. Slot-loader (L2269) and pi5-diag (L2320) don't link `osc_admit.o`, so they don't need it. - Images made outside make, and images edited after linking, are not covered. - The check depends on the symbol surviving in the image. If a stripping or LTO step is ever added before the check, the banner grep becomes the only signal. Layer 4: `osc-code-flip-guard` (`Makefile` L1685-1745, in `test` at L1574-1575). Detects regressions only; it does not block any build. - Checks that the flip is absent from the default object and the launch-only object, and present in the receipt-test object. Checks that the compiler refuses release, staging and service builds (`-fsyntax-only`, matching on the error text), and that make refuses all three (`make -n`). - It runs only when someone runs `make test`. CI never runs it (see below), so today it guards nothing on PRs. Default and release builds - `-DCK_OSC_RECEIPT_TEST` is added in exactly one place: `ART_TRUST_FLAGS += -DCK_OSC_RECEIPT_TEST=1` at L885, inside `ifeq ($(strip $(CK_OSC_RECEIPT_TEST)),1)`. The variable is empty by default (L871), and `CK_OSC_LAUNCH_TEST` no longer pulls it in (L862 adds only `-DCK_OSC_LAUNCH_TEST=1`). - In `osc_admit.c`, every use of the flip is under `#ifdef CK_OSC_RECEIPT_TEST`: the function (L273-280), the two call sites (L314-319 and L321-324), `rt_all` including the banner (L365-405), and its call (L409-412). - The variant-3 handling that sits outside those guards (`s->variant == 3 ? 0 : ...` at L313 and L348) only maps variant 3 to the qualification-policy name. It can't flip bytes. A default or release `osc_admit.o` therefore has neither the symbol nor the banner. That agrees with the author's local `nm` and `grep` results. Known gaps and minimum fixes - CI doesn't run `make test`. `aien-verification.yml` only builds `crumb` and runs `crumb verify` plus repo checks. Nothing builds the kernel. Fix: add a CI job that runs `make -C native/kernel osc-code-flip-guard`. It is a host build with no cross toolchain or QEMU. Ideally add `make -C native/kernel test` too. - A hand-written compiler command can get around the Makefile. Fix: drive the release check in `osc_admit.c` from an explicit opt-in such as `#if defined(CK_OSC_RECEIPT_TEST) && !defined(CK_QEMU_RECEIPT_SELFTEST_IMAGE)`, set only by the L872 block, rather than from the absence of the TEST anchor. Even better, have release, staging and service builds always pass a positive marker like `-DCK_PRODUCTION_IMAGE=1` through `KCFLAGS` (not only on the `osc_admit.o` line), and `#error` on it. Then any production path that goes through `KCFLAGS` refuses the flag, not just the one object rule. - The QEMU receipt boot is NOT_RUN. Variant 3's runtime claim is unproven: launch 19 should return `REFUSED_AT_ADMISSION code=16 CODE_HASH_MISMATCH` with nothing mapped. The `qemu_ck_osc_receipt_test.sh` changes (19 launches, 16 refused) are only expectations so far. Fix: run the script once on a host that has `qemu-system-aarch64`, and attach the serial log before merging. Mergeability and CI: `mergeable: false`, `mergeable_state: dirty`. This branch conflicts with `main`, which has moved on since #439 merged, so it needs a main merge and `.crumb` regeneration. On this head, AIEN Checks, CodeQL (c-cpp, rust, python, actions) and sbom pass, and AIEN Alpha is skipped. None of those build this kernel. Overall verdict: guard design OK, not merge-ready. Within the Makefile, layers 1-3 together prevent the flip from getting into a staging, service or default/release `make all`/`make full` image. The remaining risks are that layer 4 isn't run in CI, that the release `#error` depends on the absence of a define, and that the variant-3 boot hasn't run. Before merging: rebase onto main, add the guard target to CI, and attach the QEMU receipt log. This touches the admission code-hash path, so the merge decision should go to the security-boundary owner. — Grokbot drakestapleton reviewed (COMMENTED) on 2026-10-30 12:31 UTC Re-review at `98676f2960de23d9210e33c737acb853a42998cf`. This is a COMMENT, not an approval. I compared this head against my review at `d288a845` (pullrequestreview-`5712004443`). I read the diff of the new commits, mainly `8c023766` and `91d2351e`, plus the `main` merges, `native/kernel/Makefile` and `core/osc_admit.c` at this head, and the author notes in issuecomment-`6522846577`. Gap (b): the release `#error` depended on the seed anchor being absent. Verdict: closed. - `core/osc_admit.c:53-69`: the flip now has its own opt-in, `CK_OSC_RECEIPT_CODE_FLIP`. Each define is rejected without the other (L53-57). The flip is also rejected with `CK_RELEASE_IMAGE` (L59), `CK_HARDWARE_STAGING` (L62), `CK_SERVICE` (L65), and without `CK_SEED0B_TEST_ANCHOR` (L68). - The flip function and both call sites are now under `#ifdef CK_OSC_RECEIPT_CODE_FLIP` (L285, L326, L333). The seed anchor plus `CK_OSC_RECEIPT_TEST` no longer compiles the flip. - `Makefile:887`: the opt-in is added only inside the `CK_OSC_RECEIPT_TEST=1` block. That block still `$(error)`s for staging, for service and without the seed anchor. - Release define order: - `Makefile:925-933` appends `-DCK_RELEASE_IMAGE=1` to `KCFLAGS` after `$(CK_EXTRA_CFLAGS)` when the anchor is empty. `Makefile:843-845` only allows the anchor to be empty or 1. - The `osc_admit.o` recipe (`Makefile:1167-1169`) adds `-DCK_RELEASE_IMAGE=1` again as the last flag, after `KCFLAGS`, `ART_TRUST_FLAGS` and the staging and service `-D`s. - So `-UCK_RELEASE_IMAGE` in extra cflags cannot cancel it. Even a command-line `KCFLAGS=` override cannot, because the recipe repeats the define. - The staging and service `-D`s still come after `KCFLAGS` on that line. - Every release path: - Core `$(ELF)` (L1386-1397) and `$(FULL_ELF)` (L1399-1413) both link `CORE_OBJS`. That means one `osc_admit.o`, built by that one rule (`ART_C` → `CORE_C`, L970/L979). - `$(EFI)` is `pe_image` of the checked `$(ELF)` (L1415-1416). - `osc_rehash_check` (L1354-1366) still runs on both ELFs and deletes any non-receipt image that carries the symbol or the banner. - `osc-code-flip-guard` now also checks that a seed-only object, a launch-test object and a default object contain neither the banner nor `ck_osc_receipt_test_code_flip`. It also checks that each refusal names the define that triggered it, including `CK_RELEASE_IMAGE`. Gap (a): layer 4 (the guard) was not in CI. Verdict: closed. I audited `.github/workflows/osc-code-flip-guard.yml`: - It is 24 lines, runs on `pull_request` only, and has no `pull_request_target`. - The only permission is `contents: read`. There are no secrets and no writes. - `actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0` is pinned to the full SHA and matches `sbom.yml` (#462 policy). It uses `persist-credentials: false` and `timeout-minutes: 10`. - The only other step is `make -C native/kernel osc-code-flip-guard`. The target ends with `exit 1` on any failure (`Makefile:1774`), so a guard failure fails the job. - It ran on this head and succeeded: job `124059436438`, run `41054776815`. Gap (c): the QEMU boot was NOT_RUN. Verdict: claimed PASS, but only asserted. The author comment quotes the serial lines: launch 19 `REFUSED_AT_ADMISSION code=16 CODE_HASH_MISMATCH`, `refused=16`, `AIENOS_CK_OSC_RECEIPT: PASS`, `commit 98676f2960de`. However, `qemu_ck_osc_receipt_test.log` and `qemu_ck_osc_receipt_serial.log` are neither committed in this PR nor attached, and no CI job runs this script. The claim is consistent and specific, but no reviewer can check it independently. Attaching both logs, or a gist with their sha256, would close this. Remaining gap: a hand-written test build with no production defines. This is a compiler command that passes the anchor, launch test, receipt test and opt-in, and none of the three production defines. I think this is acceptable for a test-only path: - It is literally the qualification self-test command line. - Any make-built release image gets `CK_RELEASE_IMAGE` as its last flag, and `osc_rehash_check` deletes any non-receipt ELF carrying the flip. - An attacker able to hand-craft compiler lines or edit the image after link is outside what a source guard can stop. That case belongs to signing and measurement. The other limits the author lists (the PE is not re-checked, which is fine because it is derived from the checked ELF; opt-in injection through `CK_EXTRA_CFLAGS` into a qualification make is caught at link) are acceptable as documented. Mergeability and CI: `mergeable: true`, `mergeable_state: clean`. The earlier `dirty` state is resolved by the merges of `main` at `a525c405` and `b00c728c`, plus the crumb regeneration. These succeeded on `98676f29`: AIEN Checks, osc-code-flip-guard, sbom, CodeQL, and Analyze for actions, c-cpp, python and rust. AIEN Alpha was skipped, which is expected on a PR. Overall: gaps (a) and (b) are closed in code and in CI. The guard design now holds at the source, make, link and CI layers. The only open item is evidence: please attach the QEMU logs. From a guard-design standpoint I have no blocking concerns. Merge is the maintainers' decision. — Grokbot drakestapleton reviewed (COMMENTED) on 2026-10-30 13:02 UTC Head re-check at `712520bc0578593e27b36cca6813dc8f87970a0e` (COMMENT, not an approval). Since `98676f29`/`df4352e4`, this head adds only the merge of main `77514f7e` (#475, actions/checkout bump) and regenerated `.crumb` files. The three workflow files come in from main byte-identical. - Parents: `df4352e4c8ff118ebce8c01f77897158ad5795ae` and `77514f7ef96cf09fa0149e81951398e8e3608ee5`. - `df4352e4...712520bc`: 4 files, the root `.crumb` plus `.github/workflows/{aien-verification,copilot-setup-steps,sbom}.yml`. Their blobs at the head (`e8a75fa3`, `340c5d04`, `ed36c38e`) are identical to those at `77514f7e`. No code, build, log or test changes. - `77514f7e...712520bc`: the net PR diff has the same 7 non-crumb files with the same blob SHAs as `df4352e4` against its merge base `4f7f13d8`, so the code and the guard (`osc-code-flip-guard.yml` `f0205252`) are unchanged. Only the same 5 `.crumb` files differ. - Checks at this SHA: all green, including osc-code-flip-guard, AIEN Checks, sbom, CodeQL and Analyze (actions, c-cpp, python, rust). AIEN Alpha was skipped as usual. There are no legacy statuses. - Mergeability: mergeable, state clean. Code-hash refusal is QEMU-verified only; hardware is NOT_RUN. — Grokbot ### Fetch it A git bundle of the pull request's head, 40606 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/aienux/patches/dbc6dd8af1318482.bundle -o dbc6dd8af1318482.bundle git fetch dbc6dd8af1318482.bundle refs/pull/391/head ``` Raw bundle · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aienux 391 712520bc0578593e27b36cca6813dc8f87970a0e ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aienux","number":391,"url":"https://github.com/aien-dev/aienux/pull/391","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:20Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 27fea635..bf5266b4 100644 --- a/.crumb +++ b/.crumb @@ -33,14 +33,14 @@ "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "8b49afe04474e38715a657115cc9dfe46e6ed9231870ca991ff519aa55778cde", - "last_commit": "dc9a9961", + "digest": "1f02102b90f85ebe5f0adbf744447263e1731feb1e6182185382e630698f50dc", + "last_commit": "b49f84eb", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { - "digest": "8650bf3aae02e1f11fe999a3cd8c1399df071d318e6ecb642bc366a282e75fbf", - "last_commit": "8182d6d3", + "digest": "2eeb83a186f413cd87d904a1bff118758e10bc3921c288762c2e07d87d21e503", + "last_commit": "d288a845", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." }, @@ -51,15 +51,15 @@ "purpose": "First-party host artifact preparation tools" } ], - "children_root": "sha256:bc8b97c442cfc3f61da2044286e1df80f74afcaeaa1a52828912e9999e5d53cd", - "compiled_at": "2026-10-30T12:45:26Z", + "children_root": "sha256:7c5deeeae4fe5eb1611e24cd00c6059f931140e4d331fa93be5decee6019e889", + "compiled_at": "2026-10-30T12:55:07Z", "compiler": "crumb-compile/1", - "digest": "sha256:6dbaf1566cb4be5b627b28dc8b0313fde2ebf3751d92a6be0ceb38a2a14c6e57", - "evidence_files": 236, - "evidence_root": "sha256:55ef5621f09577ce1ada90d990955aec996d15e16a9b0f6953ecb90f3ca499df", - "files": 3583, - "generated_at_commit": "f30e30ee7c35e5d74f3e8862e6eb5a3eb3e16778", - "source_tree": "sha256:f1ac752774c550d5c880ec33a85839a18ee83e5aeeb95d5255d0b00cfd5a08b8" + "digest": "sha256:c0e132c3e3a85983b035d63af5c24fed0cd9e8e2345232f6e9dd7fdd61a01325", + "evidence_files": 238, + "evidence_root": "sha256:7a2a6f0fd6318a14bc86b8707a3bf324f2ed8e5c55403e5a01ab2e8df45ff308", + "files": 3586, + "generated_at_commit": "df4352e4c8ff118ebce8c01f77897158ad5795ae", + "source_tree": "sha256:845a5188c28f7a14af7cc3ea19238576fe38a8ed8a6167b690731815f0bc8215" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/osc-code-flip-guard.yml b/.github/workflows/osc-code-flip-guard.yml new file mode 100644 index 00000000..f0205252 --- /dev/null +++ b/.github/workflows/osc-code-flip-guard.yml @@ -0,0 +1,24 @@ +# Host-only pull-request check for the TEST-ONLY post-admission OSC code flip. +# Compiles native/kernel/core/osc_admit.c with the host compiler. No cross +# toolchain, no QEMU, no change to any other workflow. +name: OSC code-flip guard + +on: + pull_request: + +permissions: + contents: read + +jobs: + osc-code-flip-guard: + name: osc-code-flip-guard + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + + - name: make -C native/kernel osc-code-flip-guard + run: make -C native/kernel osc-code-flip-guard diff --git a/evidence/qemu_ck_osc_receipt_serial.log b/evidence/qemu_ck_osc_receipt_serial.log new file mode 100644 index 00000000..b5c44100 --- /dev/null +++ b/evidence/qemu_ck_osc_receipt_serial.log @@ -0,0 +1,187 @@ +UEFI firmware (version 2024.02-2ubuntu0.10 built at 15:40:28 on Sep 23 2026) +[=3h[=3hBdsDxe: loading Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x1,0x0) +BdsDxe: starting Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x1,0x0) + +report_version: 1 +aienos_commit: 98676f2960de23d9210e33c737acb853a42998cf +report_kind: pre_exit +last_stage: firmware_entry +gop: ok from=conout handles=2 mode=1/3 800x600 pitch=800 format=1 base=0xbc7a0000 size=0x300000 +model_map: absent (no \EFI\AIENOS\MODEL.MAP on the boot volume) +kernel_impl: c (native/kernel, Lane 18) +firmware_vendor: Ubuntu distribution of EDK II +firmware_revision: 0x10000 +firmware_el: EL2 +counter_frequency_hz: 62500000 +acpi_rsdp: 0xbc460018 +uart: pl011 spcr type=0x3 base=0x9000000 +image: 0xbc325000-0xbc460000 +exiting firmware boot services +screen: gop 800x600 pitch=800 format=bgrx base=0xbc7a0000 bytes=0x1d4c00 scale=1 grid=100x60 font=8x8 mode=half-scroll + +report_version: 1 +aienos_commit: 98676f2960de23d9210e33c737acb853a42998cf +report_kind: kernel +last_stage: kernel_el1 +mmu: enabled +pt_frames_used: 21 +mmu_switch: firmware=EL2 firmware_mmu=on firmware_ttbr0=0x47fff000 aienos_root=0x40000000 ttbr0_el1=0x40000000 switched=yes +mmu_regs: mair=0x4404ff tcr=0x580903510 sctlr=0x30d01805 +memory: ram_ranges=30 free_bytes=2034098176 stack=0x40010000-0x40050000 heap=0x48001000-0x4c001000 dma=0x40200000-0x40a00000 exit_attempts=1 +guard_page: ok fault=contained (stack=0x4000f000 heap_lo=0x48000000 heap_hi=0x4c001000) [C kernel addition, not in the Rust kernel] +gic: v3 +timer_irq: 19 ticks in 200 ms +gic_madt: gicd=0x8000000 gicr=0x80a0000 arch_rev=3 icc_sre=1 +gic_redistributor: frame=0x80a0000 +timer_stats: intid=30 freq_hz=62500000 period_us=10000 min_us=10029 avg_us=10112 max_us=10200 +exception_level: EL1 +kernel: alive +kernel_el: EL1h +cpu_features: dotprod=1 i8mm=1 bf16=1 fhm=1 fp16=1 sve=1 rndr=1 +entropy: rndr feat_rng=yes probe_words=2 retries=0 stuck_test=ok +smp: boot_mpidr=0x0 madt_cpus=4 conduit=smc psci_version=1.1 +smp_cpu_on: target=0x1 psci_rc=0 (SUCCESS) +smp_cpu_on: target=0x2 psci_rc=0 (SUCCESS) +smp_cpu_on: target=0x3 psci_rc=0 (SUCCESS) +smp_cpu: target=0x1 checked_in=yes seen_mpidr=0x1 el=1 mmu=on ttbr0_match=yes stack_ok=yes parked=wfe +smp_cpu: target=0x2 checked_in=yes seen_mpidr=0x2 el=1 mmu=on ttbr0_match=yes stack_ok=yes parked=wfe +smp_cpu: target=0x3 checked_in=yes seen_mpidr=0x3 el=1 mmu=on ttbr0_match=yes stack_ok=yes parked=wfe +smp: cpus=4 started=4 checked_in=4 psci_errors=0 distinct_mpidrs=4 wait_us=59 result=ok +threads: ok interleave=ABABABABAB +el0 user: hello +el0: ok write=granted forged=denied fault=contained exit=0 +preempt: ok a=13039143 b=8720141 switches=4 +placement: worker0=class0/core0 worker1=class0/core1 +ipc: ok message=delivered cap=delegated rights=attenuated forged=denied revoked=denied +ipc_detail: exit_a=0x0 exit_b0=0x0 exit_b1=0x0 child=0x100000001 revoke=0 +pci: ecam base=0x4010000000 seg=0 bus=0-255 +pci: 00:00.0 1b36:0008 class=060000 host-bridge +pci: 00:01.0 1af4:1001 class=010000 scsi +pci: 00:02.0 1b36:0010 class=010802 nvme +pci: 3 functions, 0 bridges followed, bars assigned_here=0 unassigned=0 (window: QEMU virt mmio32, QEMU-only assumption) +pci_disc: seg 0000 bus 00-ff functions=3 bridges=0 rc=0 +pci_disc: 0000:00:00.0 1b36:0008 class=060000 rev=00 +pci_disc: 0000:00:01.0 1af4:1001 class=010000 rev=00 +pci_disc: 0000:00:02.0 1b36:0010 class=010802 rev=02 +pci_disc: segments=1 functions=3 (read-only, no config writes) +mmio_win: 0000:00:02.0 bar0 addr=0x8000004000 size=0x1000 create=0 read(VS)=0 value=0x10400 past-end=-504 shared-map-refused=1 revoke=0 after-revoke=-2 unmapped=1 (read-only, report-only) +dma_sweep: seg 0000 bus 00-ff functions=3 bridges=0 bridges_bme=0 endpoints_bme_found=2 still_enabled=0 +dma_sweep: bme cleared 0000:00:01.0 command 0x0005 -> 0x0001 +dma_sweep: bme cleared 0000:00:02.0 command 0x0007 -> 0x0003 +nvme: firmware left bus master on, cleared before the DMA gate (ok) +nvme: discovery 00:02.0 vid=0x1b36 did=0x0010 bar0=0x8000004000 size=0x4000 (firmware) +smmu: stream table 2-level log2size=16 split=6 (spans allocated per grant) +smmu: enabled base=0x9050000 stream_id=0x10 +smmu_dma_window: nvme only, translation active iova=0x40200000 len=0x26000 rid=0x10 +dma_gate: nvme granted (Confined), bus master on +nvme: identify ok vs=0x00010400 nn=256 nsid=1 mdts=7 vwc=1 max_xfer=131072 +nvme: geometry nsid=1 block_count=131072 block_size=512 +nvme: atomicity block_size=512 awupf_raw=0 nawupf_raw=0 nabspf_raw=0 nabo_blocks=0 +nvme: bounds read lba=131072 -> refused (rc=-2) +nvme: read lba=0 blocks=1 ok (rc=0) +disk: gpt ok primary+backup crc32 entries=128 used=3 aienos_index=1 first_lba=18432 last_lba=116735 blocks=98304 +disk: xlate part_lba=0 -> disk_lba=18432 (rc=0) +disk: write past partition end part_lba=98304 -> refused (xlate rc=-2,-2,-2) +nvme: rw probe part_lba=98296 disk_lba=116728 bytes=4096 write+flush+readback match (rc=0) +smmu_negative: refused dma outside window iova=0x40230000 faults=16 type=0x10 sid=0x10 addr=0x40230000 page=intact cmd_rc=0 recovery_read=ok +nvme_disc: candidate seg 0000 00:02.0 bar0=0x8000004000 decode=1 (bound: same) +nvme_disc: candidates=1 +virtio_net: not bound (no virtio-net function) +devices: pci=ok nvme=bound virtio_net=absent +acpi_scan: tables=1 refused=0 first_refusal=0 devices=46 (static scan; _STA not evaluated) +acpi_scan: control ARMH0011 COM0 mmio=0x9000000+0x1000 +xhci_acpi: 0 platform controller(s) +keyboard: no PCI xHCI controller; trying 0 ACPI platform controller(s) +keyboard: unavailable (no xHCI controller) +devices: xhci=absent (rc=1) +recovery_access: unavailable (no operator keyboard: xhci=absent); choice=normal reason=no-keyboard +stage devices: ok +argus: TEST machine id 0xA1 (fixed label, not a real machine identity, not production) +caps: ok granted=yes attenuated=yes amplify=denied forged=denied revoked=denied office_token=rndr +argus: ok narrow_revoke=1 revoked=denied unrelated=granted authority=unchanged +stage security: ok +store: TEST identity, TEST keys (public label, not secret, not production); anchor lba=0 store lba=32 units=12283 +store: opened generation=5 boot_count=1 prev_commit=ck_store_image anchor=valid-resume +store: committed generation=6 boot_count=2 +store: security manifest sequence=2 generation=6 keyslot=none previous=linked +store: limit: anchor shares this disk, so a whole-disk rollback is not detectable (needs TPM NV or another external counter) +artifact_disk: index generation=5 entries=15 chunks_used=15 chunks_ignored=0 sha256=98cac6a997d67cb4db336341a6b243cbe24ac9b7d9cc6651e41e88af9aecbf49 +artifact_disk: a01_valid_min.unit bytes=872 sha256=5711ca0a71062f7df709bde41ed80c8e724f4826b886ecc9b0ceb55f80682da4 +artifact_disk: a01.rcpt bytes=416 sha256=613e1cece39535842e2b3e406147b837b4bb1ed91628caf54735c7c09cb70996 +artifact_disk: l01.rcpt bytes=416 sha256=8330c39a4142e03fcce68bdff096dfc01dfcbb899ad03ef09b54342e7eeea403 +artifact_disk: n_altered.rcpt bytes=416 sha256=5c89817dc900fee1b945e2e1bcb43f81f0d157dcc0a1838da73b1d0cc674da94 +artifact_disk: n_stale.rcpt bytes=416 sha256=00521d58131e8ead78dcdc31446c0078b4c7332bfca9d6d32bf0c4f7d6a41ede +artifact_disk: n_revoked_id.rcpt bytes=416 sha256=e45212d1ea6956e4ef65b9a839da20af3ff9bd53c566cd233a6ae26cad658ff3 +artifact_disk: n_expired.rcpt bytes=416 sha256=b6fd9994615e42ae252ace7b1667a41482bd024be3f77835cb091519ca4a5b5b +artifact_disk: n_future.rcpt bytes=416 sha256=d91b9803b39727492d835f2e2e1a3bd87e540fa1d28449f615122ec5cd87d365 +artifact_disk: n_target.rcpt bytes=416 sha256=b05e59f36066b28069d6a1085dc5f22d27f80441729924315e1cb5aa616ec36f +artifact_disk: n_program.rcpt bytes=416 sha256=425adde14903f34672bf626c4162e9230da45dc0c503c52cdf6369a51535ad92 +artifact_disk: n_length.rcpt bytes=417 sha256=26a9a5565bd4742ba640d6ab6ddafdc0962d669250086bc5291e3a84496e1b83 +artifact_disk: n_firmware.rcpt bytes=416 sha256=be9b831461eaf5d450321c1320372f32ca3f52c3db01ccac6d6f0e89cea20449 +artifact_disk: n_deps.rcpt bytes=416 sha256=de49adf3d0c35d6d1782eaa7fd8c35074b3fbf9d230ae414b439761dad62d162 +artifact_disk: n_checker.rcpt bytes=416 sha256=5c9e707051daf1244985ef16cb18956f372686d3c5d9704142b2d44a68a762bb +artifact_disk: a01.owner.rcpt bytes=416 sha256=1348e78b0f88a5054f2b78b0a8d7c998ba70d166c711a2341528824685776034 +nvme: shutdown normal cc=0x00460001->0x00464001 csts=0x00000009 shst=complete waited_us=0 +dma_gate: nvme bus master revoked +smmu: nvme stream 0x10 returned to abort (rc=0) +stage store: ok +artifact_trust: seed0b-test qualification build — TEST ONLY +artifact_source: nvme_store generation=5 candidates=15 (read by the store stage; bytes untrusted until verified) +artifact_candidates: 15 +artifact_receipt_tier: SEED-0B-QEMU +artifact_verifier_identity: 13851dc5561e67b09460a1af7f38d60f8ea7eb07290052ae0ce36360f84f0cc8 +artifact_policy_digest: 99a8bc78011c33dd6d98a1b9b64eb0a0a5828a2ce2a283cef8ff33bfaf185982 +artifact_frames_free_before: 496589 +osc_policy: mode=qualification test_anchors=1 (throwaway TEST key, TEST ONLY) owner_anchors=0 domains=1 gen_width=32; QEMU, not physical +osc_receipt_policy: mode=qualification receipt_test_anchors=1 receipt_owner_anchors=1 (the owner root) checkers=1 target=aienos-ck-aarch64-el0 epoch_floor=10 epoch_now=20 revoked_ids=1 revoked_keys=0 firmware=none dependencies=none producer=none; launch requires a valid receipt; QEMU, not physical +osc_unit: a01_valid_min.unit ACCEPT unit_digest=c21c7d9b92433f29d588bd14eab2be4754fe39c05c7a926f1cb29b4388c68787 program_id=084803c232dc44effcc44704c9ed0600dec1231451e0b76693633e98a48d1a1d funcs=2 caps=0 signer=TEST +osc_receipt: a01.rcpt STORED bytes=416 id=613e1cece39535842e2b3e406147b837b4bb1ed91628caf54735c7c09cb70996 (verified at launch against the unit launched) +osc_receipt: l01.rcpt STORED bytes=416 id=8330c39a4142e03fcce68bdff096dfc01dfcbb899ad03ef09b54342e7eeea403 (verified at launch against the unit launched) +osc_receipt: n_altered.rcpt STORED bytes=416 id=5c89817dc900fee1b945e2e1bcb43f81f0d157dcc0a1838da73b1d0cc674da94 (verified at launch against the unit launched) +osc_receipt: n_stale.rcpt STORED bytes=416 id=00521d58131e8ead78dcdc31446c0078b4c7332bfca9d6d32bf0c4f7d6a41ede (verified at launch against the unit launched) +osc_receipt: n_revoked_id.rcpt STORED bytes=416 id=e45212d1ea6956e4ef65b9a839da20af3ff9bd53c566cd233a6ae26cad658ff3 (verified at launch against the unit launched) +osc_receipt: n_expired.rcpt STORED bytes=416 id=b6fd9994615e42ae252ace7b1667a41482bd024be3f77835cb091519ca4a5b5b (verified at launch against the unit launched) +osc_receipt: n_future.rcpt STORED bytes=416 id=d91b9803b39727492d835f2e2e1a3bd87e540fa1d28449f615122ec5cd87d365 (verified at launch against the unit launched) +osc_receipt: n_target.rcpt STORED bytes=416 id=b05e59f36066b28069d6a1085dc5f22d27f80441729924315e1cb5aa616ec36f (verified at launch against the unit launched) +osc_receipt: n_program.rcpt STORED bytes=416 id=425adde14903f34672bf626c4162e9230da45dc0c503c52cdf6369a51535ad92 (verified at launch against the unit launched) +osc_receipt: n_length.rcpt STORED bytes=417 id=- (verified at launch against the unit launched) +osc_receipt: n_firmware.rcpt STORED bytes=416 id=be9b831461eaf5d450321c1320372f32ca3f52c3db01ccac6d6f0e89cea20449 (verified at launch against the unit launched) +osc_receipt: n_deps.rcpt STORED bytes=416 id=de49adf3d0c35d6d1782eaa7fd8c35074b3fbf9d230ae414b439761dad62d162 (verified at launch against the unit launched) +osc_receipt: n_checker.rcpt STORED bytes=416 id=5c9e707051daf1244985ef16cb18956f372686d3c5d9704142b2d44a68a762bb (verified at launch against the unit launched) +osc_receipt: a01.owner.rcpt STORED bytes=416 id=1348e78b0f88a5054f2b78b0a8d7c998ba70d166c711a2341528824685776034 (verified at launch against the unit launched) +osc_receipts: seen=14 stored=14 dropped=0 (each is verified when a launch presents it) +osc_units: seen=1 accepted=1 refused=0 oversize=0 (admission; launches follow) +osc_rcpt_rehash: TEST-ONLY post-admission code byte flip; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_selftest: launches=19 unit=a01_valid_min.unit; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(1,2) receipt=a01.rcpt policy=qualification -> RETURNED value=3 receipt_id=613e1cece3953584 revoked=- ticks=0 pages_mapped=20 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(2,3) receipt=none policy=qualification -> REFUSED_AT_ADMISSION code=64 name=RECEIPT_MISSING receipt_id=- revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(3,4) receipt=n_altered.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=75 name=RECEIPT_BAD_SIGNATURE receipt_id=5c89817dc900fee1 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(4,5) receipt=n_stale.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=77 name=RECEIPT_STALE_EPOCH receipt_id=00521d58131e8ead revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(5,6) receipt=n_revoked_id.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=76 name=RECEIPT_REVOKED receipt_id=e45212d1ea6956e4 revoked=receipt_id ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(6,7) receipt=a01.rcpt policy=revoked_test_key -> REFUSED_AT_ADMISSION code=76 name=RECEIPT_REVOKED receipt_id=613e1cece3953584 revoked=signer_key ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(7,8) receipt=n_expired.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=78 name=RECEIPT_EXPIRED receipt_id=b6fd9994615e42ae revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(8,9) receipt=n_future.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=79 name=RECEIPT_NOT_YET_VALID receipt_id=d91b9803b3972749 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(9,10) receipt=n_target.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=80 name=RECEIPT_WRONG_TARGET receipt_id=b05e59f36066b280 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(10,11) receipt=l01.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=83 name=RECEIPT_EXECUTABLE_MISMATCH receipt_id=8330c39a4142e03f revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(11,12) receipt=n_program.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=82 name=RECEIPT_PROGRAM_MISMATCH receipt_id=425adde14903f346 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(12,13) receipt=n_length.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=65 name=RECEIPT_SIZE receipt_id=- revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(13,14) receipt=a01.rcpt policy=release -> REFUSED_AT_ADMISSION code=73 name=RECEIPT_TEST_SIGNER_IN_PRODUCTION receipt_id=613e1cece3953584 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(14,15) receipt=n_firmware.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=81 name=RECEIPT_WRONG_FIRMWARE receipt_id=be9b831461eaf5d4 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(15,16) receipt=n_deps.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=88 name=RECEIPT_DEPENDENCIES_MISMATCH receipt_id=de49adf3d0c35d6d revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(16,17) receipt=n_checker.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=86 name=RECEIPT_UNTRUSTED_CHECKER receipt_id=5c9e707051daf124 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(17,18) receipt=a01.owner.rcpt policy=release -> RETURNED value=35 receipt_id=1348e78b0f88a505 revoked=- ticks=0 pages_mapped=20 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(18,19) receipt=a01.rcpt policy=qualification -> REFUSED_AT_ADMISSION code=16 name=CODE_HASH_MISMATCH receipt_id=613e1cece3953584 revoked=- ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launch: a01_valid_min.unit add(20,22) receipt=a01.rcpt policy=qualification -> RETURNED value=42 receipt_id=613e1cece3953584 revoked=- ticks=0 pages_mapped=20 page_tables_zeroed=1 slot_free=1; QEMU (aarch64 virt), TEST signer, not physical +osc_rcpt_launches: returned=3 trapped=0 refused=16 unknown=0; QEMU (aarch64 virt), TEST signer, not physical +artifact_frames_free_after: 496589 +artifact_disk: released heap copies artifacts=15 bytes=6697 +mm_usage: stack_bytes=262144 stack_used=69312 heap_bytes=67108864 heap_free=64924640 heap_min_free=64879680 + +report_version: 1 +aienos_commit: 98676f2960de23d9210e33c737acb853a42998cf +report_kind: final +last_stage: final +artifact_trust: seed0b-test qualification build — TEST ONLY +artifacts: candidates=15 admitted=0 rejected=0 +note: QEMU qualifies nothing physical +devices: quiesce before reset nvme=already-released diff --git a/evidence/qemu_ck_osc_receipt_test.log b/evidence/qemu_ck_osc_receipt_test.log new file mode 100644 index 00000000..7356683b --- /dev/null +++ b/evidence/qemu_ck_osc_receipt_test.log @@ -0,0 +1,52 @@ +PASS boot disk built: ck_store_image: /tmp/tmp.1icyY5AMJN/nvme.img artifacts=15 store_generation=5 (TEST identity, TEST keys) +Could not open option rom 'vgabios-ramfb.bin': No such file or directory +qemu exit 0 after 6 s (commit 98676f2960de) +PASS left firmware and entered the kernel +PASS kernel read all fifteen candidates (one unit, fourteen receipts) from the boot disk Store +PASS no kernel report line was truncated +PASS final report reached the console +PASS no kernel panic or fault report +PASS a01 admitted (the container check is unchanged) +PASS receipt policy line: qualification, TEST receipt anchor, the owner root as owner receipt anchor, launch requires a receipt +PASS a01.rcpt stored from the Store (bytes=416) +PASS l01.rcpt stored from the Store (bytes=416) +PASS n_altered.rcpt stored from the Store (bytes=416) +PASS n_stale.rcpt stored from the Store (bytes=416) +PASS n_revoked_id.rcpt stored from the Store (bytes=416) +PASS n_expired.rcpt stored from the Store (bytes=416) +PASS n_future.rcpt stored from the Store (bytes=416) +PASS n_target.rcpt stored from the Store (bytes=416) +PASS n_program.rcpt stored from the Store (bytes=416) +PASS n_length.rcpt stored from the Store (bytes=417) +PASS n_firmware.rcpt stored from the Store (bytes=416) +PASS n_deps.rcpt stored from the Store (bytes=416) +PASS n_checker.rcpt stored from the Store (bytes=416) +PASS a01.owner.rcpt stored from the Store (bytes=416) +PASS receipt totals: 14 seen, 14 stored +PASS self-test announces 19 launches +PASS valid receipt: the unit runs, add(1,2) RETURNED 3 +PASS no receipt: refused RECEIPT_MISSING (64) +PASS altered receipt (one byte of the executable digest flipped): RECEIPT_BAD_SIGNATURE (75) +PASS replayed receipt below the epoch floor: RECEIPT_STALE_EPOCH (77) +PASS revoked receipt id: RECEIPT_REVOKED (76), revoked=receipt_id +PASS revoked signer key (the TEST key fingerprint revoked): RECEIPT_REVOKED (76), revoked=signer_key +PASS expired receipt: RECEIPT_EXPIRED (78) +PASS receipt not yet valid: RECEIPT_NOT_YET_VALID (79) +PASS receipt for another target: RECEIPT_WRONG_TARGET (80) +PASS receipt for another executable (l01's): RECEIPT_EXECUTABLE_MISMATCH (83) +PASS receipt for another program: RECEIPT_PROGRAM_MISMATCH (82) +PASS receipt of the wrong length (417 bytes): RECEIPT_SIZE (65) +PASS TEST receipt under the release policy: RECEIPT_TEST_SIGNER_IN_PRODUCTION (73) +PASS receipt naming firmware: RECEIPT_WRONG_FIRMWARE (81) +PASS receipt with a dependency: RECEIPT_DEPENDENCIES_MISMATCH (88) +PASS receipt from an unlisted checker: RECEIPT_UNTRUSTED_CHECKER (86) +PASS owner receipt (signed on the owner YubiKey) in release mode: the unit runs, add(17,18) RETURNED 35 +PASS valid receipt with code changed after admission: CODE_HASH_MISMATCH (16), nothing mapped or executed +PASS after every refusal, the valid receipt still runs the unit: add(20,22) RETURNED 42 +PASS summary: 3 returned, 16 refused +PASS exactly 19 receipt launch lines +PASS every other refusal names a reason of its own +PASS only the receipt self-test ran +label: QEMU (aarch64 virt), TEST signer, not physical +AIENOS_CK_OSC_RECEIPT: PASS +EXIT:0 diff --git a/native/.crumb b/native/.crumb index cb193528..d33268ff 100644 --- a/native/.crumb +++ b/native/.crumb @@ -50,13 +50,13 @@ "children": [ { "digest": "72ee4e94f3dc99d79ea4eb3bf619ad645c0b76d7009d1883e59adfbfce9c8ac2", - "last_commit": "d7012755", + "last_commit": "2c9c8b50", "name": "argus", "purpose": "Directory native/argus. Purpose not yet described by a human." }, { "digest": "5187cf88f03271fb2a89fd18d0a97212ae419491d9bd510732bdbe54a0ccf263", - "last_commit": "8182d6d3", + "last_commit": "2c9c8b50", "name": "boot", "purpose": "Directory native/boot. Purpose not yet described by a human." }, @@ -68,31 +68,31 @@ }, { "digest": "ec6a4295568339a6dea0df513d23cf7a28a90d07bee2cd8f93a7417b48ff7871", - "last_commit": "f45d00ad", + "last_commit": "2c9c8b50", "name": "crypto", "purpose": "Directory native/crypto. Purpose not yet described by a human." }, { "digest": "43e1cf9e246a9cdfca6b1147381ad071e1cffaf408bb58d3e09b7001e7b0eb5c", - "last_commit": "aab6de6d", + "last_commit": "b5e72686", "name": "disk", "purpose": "Directory native/disk. Purpose not yet described by a human." }, { - "digest": "b42be1f0641ee6f758ee7a75ce749d2c03f69027b6c5c5cd4473f88c2cfe1137", - "last_commit": "8182d6d3", + "digest": "466925f29e7cac39d858d1c12f982e65f288fc2d51b07712dba7c07d67b815e4", + "last_commit": "8c023766", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, { "digest": "b9588f7026aaa3fbf7777f5c10d90a1c915cc301be98be5081d3d66106cf77c8", - "last_commit": "f45d00ad", + "last_commit": "2c9c8b50", "name": "m5", "purpose": "Directory native/m5. Purpose not yet described by a human." }, { "digest": "b0c2410bb450a0bf6156e064185b024b622fd844e87d7acd476df10c7af63cf6", - "last_commit": "0d73933a", + "last_commit": "dc9a9961", "name": "net", "purpose": "Directory native/net. Purpose not yet described by a human." }, @@ -104,26 +104,26 @@ }, { "digest": "6f0bf10c76df492d27ae642792476c1138bc73f0d897b3ddca04605ac07b4268", - "last_commit": "f45d00ad", + "last_commit": "2c9c8b50", "name": "sig", "purpose": "Directory native/sig. Purpose not yet described by a human." }, { "digest": "e125172a18437b662edf303f4b9615bb791f5e7d2ed94192033823185e7d40e1", - "last_commit": "f45d00ad", + "last_commit": "2c9c8b50", "name": "store", "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:2fb1c462f8c24cd91ad839bb18c8dbc2c388f52f6fd61f4c8350449d696d2199", - "compiled_at": "2026-10-30T12:07:40Z", + "children_root": "sha256:74390fa3225744b511df76ca77b020a50a6c955c13eebd77419a961e25140087", + "compiled_at": "2026-10-30T12:20:30Z", "compiler": "crumb-compile/1", - "digest": "sha256:8b49afe04474e38715a657115cc9dfe46e6ed9231870ca991ff519aa55778cde", + "digest": "sha256:1f02102b90f85ebe5f0adbf744447263e1731feb1e6182185382e630698f50dc", "evidence_files": 24, "evidence_root": "sha256:ecc7ccf2e924c221a5bac1d91e23b13d8f3c8d78c2a893a882ed7ca5e88d855d", "files": 676, - "generated_at_commit": "0d73933a87160adb6a4e9987d647d19fa56cbb19", - "source_tree": "sha256:1c68fa7c52131a5095fbceb4b5992b336dba1c16abec069d534ecb4c1e34e782" + "generated_at_commit": "b49f84eb422b789626be68886e8ea90ec08cedd5", + "source_tree": "sha256:cd811f200f5cd4890d077459709ce4c3690d8321e7e981f749733f5537b85a05" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/.crumb b/native/kernel/.crumb index 0161801b..c95eff57 100644 --- a/native/kernel/.crumb +++ b/native/kernel/.crumb @@ -57,14 +57,14 @@ "purpose": "Directory native/kernel/artifact. Purpose not yet described by a human." }, { - "digest": "e6a371afcab6664b74ed49199722a013c18d962fc48b5907eeb18e14b3c35ba1", - "last_commit": "f45d00ad", + "digest": "d4196275e1dc11d6b92d0fe9b90bbd9b7bbef17cd4ec63bc2fb09acfa7bd7b90", + "last_commit": "d288a845", "name": "core", "purpose": "Directory native/kernel/core. Purpose not yet described by a human." }, { "digest": "c943647976dcb5c770e04fc9da06f921c581866c680449cb5a483de3226e4483", - "last_commit": "c01180eb", + "last_commit": "8182d6d3", "name": "dev", "purpose": "Directory native/kernel/dev. Purpose not yet described by a human." }, @@ -82,32 +82,32 @@ }, { "digest": "007a51e72c3f3064b7ad4c12575067a8db6c71d9820d057ab7aa101e129e431a", - "last_commit": "832bcbd9", + "last_commit": "8182d6d3", "name": "svc", "purpose": "Directory native/kernel/svc. Purpose not yet described by a human." }, { "digest": "c90db8713d6ae7ec55d252ef3cc96f168804c0fa7e77509a1ef4f6b41bf5cc78", - "last_commit": "89e296db", + "last_commit": "8182d6d3", "name": "tests", "purpose": "Directory native/kernel/tests. Purpose not yet described by a human." }, { "digest": "b9e7c05043b82668b22343765e7ca61d06f5132dacbb623bd333e3e9e577eafc", - "last_commit": "89e296db", + "last_commit": "8182d6d3", "name": "tools", "purpose": "Hosted (Linux-built) checkers for the native kernel, run by `make -C native/kernel test`; nothin" } ], - "children_root": "sha256:e8a52b62f13d23bb776650e0c2ea134772a550b993d55c08c6e59201b1625a02", - "compiled_at": "2026-10-30T11:26:28Z", + "children_root": "sha256:2830fb8909c2f0daf4d958ef74919ba75272df6bcdf790a510559d6578ba203b", + "compiled_at": "2026-10-30T12:19:24Z", "compiler": "crumb-compile/1", - "digest": "sha256:b42be1f0641ee6f758ee7a75ce749d2c03f69027b6c5c5cd4473f88c2cfe1137", + "digest": "sha256:466925f29e7cac39d858d1c12f982e65f288fc2d51b07712dba7c07d67b815e4", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 429, - "generated_at_commit": "32c1fa8bf81fd890c0313699e6254d06676695bf", - "source_tree": "sha256:f22d5baeb5ad735ea2d906138f096a0c14c627a19037678d3a8bfd46b0d1b2ee" + "generated_at_commit": "84ee2a02f78229167998d21a8ff03fe65bedb821", + "source_tree": "sha256:2784eac2c1866d2f4ce8a87b27ce5f02fd5e19aa0579347c9b77f36e7f4d4b77" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index e88f0062..c0f48043 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -797,14 +797,24 @@ policy, ambiguities and the UNVERIFIED list: `docs/osc-receipts.md`. - Host tests: `tests/test_osc_receipt.c`, part of `make test` and `make sanitize`, built for the qualification and the release policy. Mutants: `make osc-receipt-mutants`, 25 of 25 guards killed. - QEMU gate: one boot of the qualification image built with `CK_SEED0B_TEST_ANCHOR=1 CK_OSC_LAUNCH_TEST=1 - CK_OSC_RECEIPT_TEST=1` (TEST ONLY). The Store holds a01_valid_min.unit, 13 receipts minted by omega - checker2 with its TEST key and one receipt signed with the owner key (`a01.owner.rcpt`, aienos#387). 18 launches + CK_OSC_RECEIPT_TEST=1` (TEST ONLY). `CK_OSC_RECEIPT_TEST` is empty by default. Variant 3 (one admitted code + byte flipped after admission and restored after launch, `ck_osc_receipt_test_code_flip`) is compiled only + into that image, and only when the Makefile also passes `-DCK_OSC_RECEIPT_CODE_FLIP=1`. The seed anchor + does not enable the flip. `core/osc_admit.c` `#error`s if the receipt-test define lacks that opt-in, if the + opt-in lacks the receipt-test define, or if the opt-in is combined with `CK_RELEASE_IMAGE`, + `CK_HARDWARE_STAGING` or `CK_SERVICE`. The Makefile refuses the make variable on a release build, with + `CK_HARDWARE_STAGING`, and with `CK_SERVICE`. `make osc-code-flip-guard` (part of `make test`) checks + those refusals and that a default object has neither the banner nor the symbol. + Linking an image checks the same: a receipt-test image must carry both, every other image must carry neither. + The Store holds a01_valid_min.unit, 13 receipts minted by omega + checker2 with its TEST key and one receipt signed with the owner key (`a01.owner.rcpt`, aienos#387). 19 launches of a01 add(a, b), one `osc_rcpt_launch:` line each: the valid receipt RETURNS 3 and, after every refusal, 42; the owner receipt in release mode (variant 1: the qualification policy with release set) RETURNS 35; no receipt 64 MISSING; altered 75 BAD_SIGNATURE; replayed 77 STALE_EPOCH; revoked id 76 REVOKED (`revoked=receipt_id`); revoked TEST key 76 REVOKED (`revoked=signer_key`); expired 78; not yet valid 79; wrong target 80; l01's receipt 83 EXECUTABLE_MISMATCH; other program 82 PROGRAM_MISMATCH; 417 bytes 65 SIZE; release policy 73 TEST_SIGNER_IN_PRODUCTION; firmware 81; dependency 88; - other checker 86 UNTRUSTED_CHECKER. Every refusal maps nothing (`ticks=0 pages_mapped=0`). + other checker 86 UNTRUSTED_CHECKER; one code byte changed after admission 16 CODE_HASH_MISMATCH, then the same + receipt runs again. Every refusal maps nothing (`ticks=0 pages_mapped=0`). - Owner receipt (aienos#387): the owner root is the one OWNER receipt anchor of both policies (`docs/OWNER_KEY_CEREMONY.md` section 7). The host test checks the owner receipt VALID under the release policy, all 3328 single-bit flips and the wrong-unit, wrong-target, epoch, checker and revocation controls refused, and TEST diff --git a/native/kernel/Makefile b/native/kernel/Makefile index 6f53c1df..6c7b826d 100644 --- a/native/kernel/Makefile +++ b/native/kernel/Makefile @@ -864,12 +864,27 @@ endif # aienos#383: the receipt self-test variant of the launch self-test (CK_OSC_LAUNCH_TEST=1 CK_OSC_RECEIPT_TEST=1) runs # a fixed script of launches with valid, missing and refused realization receipts instead of the C3-3a script. # TEST ONLY, QEMU only. +# The post-admission code byte flip (variant 3, ck_osc_receipt_test_code_flip in +# core/osc_admit.c) is compiled only here, and only with its own opt-in +# -DCK_OSC_RECEIPT_CODE_FLIP=1. Empty by default. -DCK_SEED0B_TEST_ANCHOR does +# not enable it. Refused in a release build (no CK_SEED0B_TEST_ANCHOR), with +# CK_HARDWARE_STAGING and with CK_SERVICE. core/osc_admit.c #errors on the same +# combinations, and also when the receipt-test define arrives without the opt-in. CK_OSC_RECEIPT_TEST ?= ifeq ($(strip $(CK_OSC_RECEIPT_TEST)),1) +ifneq ($(strip $(CK_HARDWARE_STAGING)),) +$(error CK_OSC_RECEIPT_TEST (TEST-ONLY post-admission code byte flip) cannot be combined with CK_HARDWARE_STAGING) +endif +ifneq ($(strip $(CK_SERVICE)),) +$(error CK_OSC_RECEIPT_TEST (TEST-ONLY post-admission code byte flip) cannot be combined with CK_SERVICE) +endif +ifeq ($(strip $(CK_SEED0B_TEST_ANCHOR)),) +$(error CK_OSC_RECEIPT_TEST (TEST-ONLY post-admission code byte flip) cannot be compiled into a release build) +endif ifneq ($(strip $(CK_OSC_LAUNCH_TEST)),1) $(error CK_OSC_RECEIPT_TEST needs CK_OSC_LAUNCH_TEST=1) endif -ART_TRUST_FLAGS += -DCK_OSC_RECEIPT_TEST=1 +ART_TRUST_FLAGS += -DCK_OSC_RECEIPT_TEST=1 -DCK_OSC_RECEIPT_CODE_FLIP=1 endif # OSH-AIENOS-0: the shell-core self-test (core/osh_test.c) runs the three osh units over embedded fixture scripts and # prints the step trace. TEST ONLY, QEMU only; not combined with the launch self-test. @@ -911,6 +926,12 @@ KCFLAGS := -std=gnu11 -O2 -Wall -Wextra -Werror -ffreestanding -nostdlib -fno-bu -fno-stack-protector -fno-tree-loop-distribute-patterns -mstrict-align \ -mgeneral-regs-only -mno-outline-atomics -fno-asynchronous-unwind-tables -fpie \ -fvisibility=hidden -fno-plt $(KINC) $(SMP_TEST_FLAGS) -DCK_FB_HOLD_S=$(CK_FB_HOLD_S) $(CK_EXTRA_CFLAGS) +# After CK_EXTRA_CFLAGS. gcc keeps the last -D/-U, so a -U in extra cflags +# cannot drop this. Set on every build that is not the qualification anchor. +# Nothing else reads it. osc_admit.c #errors if the code flip is combined with it. +ifeq ($(strip $(CK_SEED0B_TEST_ANCHOR)),) +KCFLAGS += -DCK_RELEASE_IMAGE=1 +endif KLDFLAGS := -nostdlib -pie --no-dynamic-linker -z norelro -z noexecstack -z max-page-size=4096 --no-warn-rwx-segments \ -T $(BOOT)/image.ld @@ -1145,7 +1166,7 @@ $(KOBJ)/kernel/core/artifact_loader.o: $(KDIR)/core/artifact_loader.c $(HDRS) $( $(KOBJ)/kernel/core/osc_admit.o: $(KDIR)/core/osc_admit.c $(HDRS) $(ART_HDRS) $(OUT)/trust.stamp @mkdir -p $(dir $@) - $(KCC) $(KCFLAGS) $(ART_TRUST_FLAGS) -c -o $@ $< + $(KCC) $(KCFLAGS) $(ART_TRUST_FLAGS) $(if $(strip $(CK_HARDWARE_STAGING)),-DCK_HARDWARE_STAGING=1,) $(if $(filter 1,$(strip $(CK_SERVICE))),-DCK_SERVICE=1,) $(if $(filter 1,$(strip $(CK_SEED0B_TEST_ANCHOR))),,-DCK_RELEASE_IMAGE=1) -c -o $@ $< # core/osh_op.c refuses to build without CK_OSH_OP_TEST (and with CK_HARDWARE_STAGING): it takes the trust flags too. $(KOBJ)/kernel/core/osh_op.o: $(KDIR)/core/osh_op.c $(KDIR)/core/osh_op.h $(HDRS) $(OUT)/trust.stamp @@ -1330,6 +1351,21 @@ define cont_check fi endef +# osc_rehash_check(elf): the post-admission code byte flip is part of a +# CK_OSC_RECEIPT_TEST image only, and that image must carry the banner and +# ck_osc_receipt_test_code_flip. Every other image must carry neither. +define osc_rehash_check + @if [ "$(strip $(CK_OSC_RECEIPT_TEST))" = 1 ]; then \ + grep -aqF "TEST-ONLY post-admission code byte flip" $(1) || { echo "receipt test image lacks the TEST-ONLY code byte flip"; rm -f $(1); exit 1; }; \ + $(KNM) $(1) | grep -q ' ck_osc_receipt_test_code_flip$$' || { echo "receipt test image lacks ck_osc_receipt_test_code_flip"; rm -f $(1); exit 1; }; \ + else \ + s=""; $(KNM) $(1) | grep -q ' ck_osc_receipt_test_code_flip$$' && s="ck_osc_receipt_test_code_flip "; \ + grep -aqF "TEST-ONLY post-admission code byte flip" $(1) && s="$${s}banner"; \ + if [ -n "$$s" ]; then echo "image carries the TEST-ONLY post-admission code byte flip: $$s"; rm -f $(1); exit 1; fi; \ + echo "no post-admission code byte flip in $(1)"; \ + fi +endef + # link_image(output elf, objects): refuses undefined symbols (weak stage # references excepted) and any relocation other than R_AARCH64_RELATIVE. define link_image @@ -1358,6 +1394,7 @@ $(ELF): $(CORE_OBJS) $(BOOT)/image.ld $(call fwcfg_check,$@) $(call smp_check,$@) $(call b7b_check,$@) + $(call osc_rehash_check,$@) $(FULL_ELF): $(CORE_OBJS) $(STAGE_BUILT) $(BOOT)/image.ld $(call link_image,$@,$(CORE_OBJS) $(STAGE_LINK) $(CK_RUST_LIBS) $(CK_INFER_LIB)) @@ -1373,6 +1410,7 @@ $(FULL_ELF): $(CORE_OBJS) $(STAGE_BUILT) $(BOOT)/image.ld $(call crash_check,$@) $(call b7b_check,$@) $(call cont_check,$@) + $(call osc_rehash_check,$@) $(EFI): $(ELF) $(call pe_image,$<,$@) @@ -1541,8 +1579,8 @@ smmu-l2-mutants: $(OUT)/host/test_smmu else echo "mutant flag refused under CK_HARDWARE_STAGING"; fi; \ if [ $$fail = 0 ]; then echo "CK_SMMU_L2_MUTANTS: PASS"; else echo "CK_SMMU_L2_MUTANTS: FAIL"; exit 1; fi -test: $(addprefix $(OUT)/host/,$(TESTS)) osc-receipt-mutants osc-receipt-release handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant context-mutant agent-cmd-mutant artifact-card-mutant artifact-tier-pi5 artifact-tier-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test slot-loader-check - @fail=0; for t in $(filter-out osc-receipt-mutants osc-receipt-release handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant context-mutant agent-cmd-mutant artifact-card-mutant artifact-tier-pi5 artifact-tier-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test slot-loader-check,$^); do $$t || fail=1; done; \ +test: $(addprefix $(OUT)/host/,$(TESTS)) osc-receipt-mutants osc-receipt-release osc-code-flip-guard handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant context-mutant agent-cmd-mutant artifact-card-mutant artifact-tier-pi5 artifact-tier-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test slot-loader-check + @fail=0; for t in $(filter-out osc-receipt-mutants osc-receipt-release osc-code-flip-guard handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants osh-op-mutant context-mutant agent-cmd-mutant artifact-card-mutant artifact-tier-pi5 artifact-tier-mutant test-continuity-subject-restart gsp-fw-inspect-test gsp-cot-test gsp-bindata-test gsp-bootargs-test gsp-rpc-test slot-test slot-free package-test slot-loader-check,$^); do $$t || fail=1; done; \ if [ $$fail = 0 ]; then echo "CK_CORE_HOST: PASS"; else echo "CK_CORE_HOST: FAIL"; exit 1; fi sanitize: $(addprefix $(OUT)/host-san/,$(TESTS)) @@ -1652,6 +1690,89 @@ $(OUT)/host/test_osc_receipt_release: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/c osc-receipt-release: $(OUT)/host/test_osc_receipt_release @$< +# The code byte flip must be absent from a default object, a seed-anchor object +# and a launch self-test object. It is present only with CK_OSC_RECEIPT_CODE_FLIP +# (which also requires CK_OSC_RECEIPT_TEST). The compiler refuses the receipt-test +# define without that opt-in, the opt-in alone, and the opt-in together with +# CK_RELEASE_IMAGE, CK_HARDWARE_STAGING, CK_SERVICE, or a release build (no seed +# anchor). make refuses the make variable for a release build, CK_HARDWARE_STAGING +# and CK_SERVICE. +OSC_FLIP_CC := $(HOSTCC) $(HCFLAGS) $(ART_HOST_INC) -I$(KDIR)/include +OSC_FLIP_SRC := $(KDIR)/core/osc_admit.c +OSC_FLIP_OPT := -DCK_SEED0B_TEST_ANCHOR=1 -DCK_OSC_LAUNCH_TEST=1 -DCK_OSC_RECEIPT_TEST=1 -DCK_OSC_RECEIPT_CODE_FLIP=1 +osc-code-flip-guard: + @mkdir -p $(OUT)/host-mut; fail=0; \ + def=$(OUT)/host-mut/osc_admit_default.o; \ + lau=$(OUT)/host-mut/osc_admit_launch.o; \ + seed=$(OUT)/host-mut/osc_admit_seed.o; \ + rcp=$(OUT)/host-mut/osc_admit_receipt.o; \ + log=$(OUT)/host-mut/osc_flip_guard.log; \ + if ! $(OSC_FLIP_CC) -c -o $$def $(OSC_FLIP_SRC); then echo "default osc_admit.c failed to compile (FAIL)"; fail=1; \ + elif grep -aqF "TEST-ONLY post-admission code byte flip" $$def || nm $$def | grep -q ck_osc_receipt_test_code_flip; then \ + echo "default osc_admit.o contains the code byte flip (FAIL)"; fail=1; \ + else echo "default osc_admit.o has no code byte flip"; fi; \ + if ! $(OSC_FLIP_CC) -DCK_SEED0B_TEST_ANCHOR=1 -c -o $$seed $(OSC_FLIP_SRC); then \ + echo "seed-anchor osc_admit.c failed to compile (FAIL)"; fail=1; \ + elif grep -aqF "TEST-ONLY post-admission code byte flip" $$seed || nm $$seed | grep -q ck_osc_receipt_test_code_flip; then \ + echo "CK_SEED0B_TEST_ANCHOR object contains the code byte flip (FAIL)"; fail=1; \ + else echo "CK_SEED0B_TEST_ANCHOR object has no code byte flip"; fi; \ + if ! $(OSC_FLIP_CC) -DCK_SEED0B_TEST_ANCHOR=1 -DCK_OSC_LAUNCH_TEST=1 -c -o $$lau $(OSC_FLIP_SRC); then \ + echo "launch-test osc_admit.c failed to compile (FAIL)"; fail=1; \ + elif grep -aqF "TEST-ONLY post-admission code byte flip" $$lau || nm $$lau | grep -q ck_osc_receipt_test_code_flip; then \ + echo "CK_OSC_LAUNCH_TEST object contains the code byte flip (FAIL)"; fail=1; \ + else echo "CK_OSC_LAUNCH_TEST object has no code byte flip"; fi; \ + if $(OSC_FLIP_CC) -DCK_SEED0B_TEST_ANCHOR=1 -DCK_OSC_LAUNCH_TEST=1 -DCK_OSC_RECEIPT_TEST=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "seed anchor plus CK_OSC_RECEIPT_TEST compiled the flip without CK_OSC_RECEIPT_CODE_FLIP (FAIL)"; fail=1; \ + elif ! grep -qF "CK_SEED0B_TEST_ANCHOR does not enable the post-admission code byte flip" $$log; then \ + echo "missing-opt-in refusal did not name CK_SEED0B_TEST_ANCHOR (FAIL)"; cat $$log; fail=1; \ + else echo "CK_OSC_RECEIPT_TEST with only the seed anchor refused"; fi; \ + if ! $(OSC_FLIP_CC) $(OSC_FLIP_OPT) -c -o $$rcp $(OSC_FLIP_SRC); then \ + echo "receipt-test osc_admit.c failed to compile (FAIL)"; fail=1; \ + elif ! grep -aqF "TEST-ONLY post-admission code byte flip" $$rcp || ! nm $$rcp | grep -q ck_osc_receipt_test_code_flip; then \ + echo "CK_OSC_RECEIPT_CODE_FLIP object lacks the code byte flip (FAIL)"; fail=1; \ + else echo "CK_OSC_RECEIPT_CODE_FLIP object contains the code byte flip"; fi; \ + if $(OSC_FLIP_CC) -DCK_OSC_RECEIPT_CODE_FLIP=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "opt-in alone compiled (FAIL)"; fail=1; \ + elif ! grep -qF "requires CK_OSC_RECEIPT_TEST" $$log; then \ + echo "opt-in-alone refusal did not require CK_OSC_RECEIPT_TEST (FAIL)"; cat $$log; fail=1; \ + else echo "CK_OSC_RECEIPT_CODE_FLIP alone refused"; fi; \ + if $(OSC_FLIP_CC) -DCK_OSC_RECEIPT_TEST=1 -DCK_OSC_RECEIPT_CODE_FLIP=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "release build accepted the code byte flip (FAIL)"; fail=1; \ + elif ! grep -qF "cannot be compiled into a release build" $$log; then \ + echo "release refusal did not name the release build (FAIL)"; cat $$log; fail=1; \ + else echo "code byte flip refused in a release build"; fi; \ + if $(OSC_FLIP_CC) $(OSC_FLIP_OPT) -DCK_RELEASE_IMAGE=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "CK_RELEASE_IMAGE accepted the code byte flip (FAIL)"; fail=1; \ + elif ! grep -qF "production or release define is present: CK_RELEASE_IMAGE" $$log; then \ + echo "CK_RELEASE_IMAGE refusal did not name CK_RELEASE_IMAGE (FAIL)"; cat $$log; fail=1; \ + else echo "code byte flip refused with CK_RELEASE_IMAGE"; fi; \ + if $(OSC_FLIP_CC) $(OSC_FLIP_OPT) -DCK_HARDWARE_STAGING=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "CK_HARDWARE_STAGING accepted the code byte flip (FAIL)"; fail=1; \ + elif ! grep -qF "production or release define is present: CK_HARDWARE_STAGING" $$log; then \ + echo "hardware-staging refusal did not name CK_HARDWARE_STAGING (FAIL)"; cat $$log; fail=1; \ + else echo "code byte flip refused with CK_HARDWARE_STAGING"; fi; \ + if $(OSC_FLIP_CC) $(OSC_FLIP_OPT) -DCK_SERVICE=1 -fsyntax-only $(OSC_FLIP_SRC) >$$log 2>&1; then \ + echo "CK_SERVICE accepted the code byte flip (FAIL)"; fail=1; \ + elif ! grep -qF "production or release define is present: CK_SERVICE" $$log; then \ + echo "service refusal did not name CK_SERVICE (FAIL)"; cat $$log; fail=1; \ + else echo "code byte flip refused with CK_SERVICE"; fi; \ + if $(MAKE) -s -n OUT=$(OUT)/host-mut/flip-mk-rel CK_OSC_RECEIPT_TEST=1 full >$$log 2>&1; then \ + echo "make accepted CK_OSC_RECEIPT_TEST on a release build (FAIL)"; fail=1; \ + elif ! grep -qF "cannot be compiled into a release build" $$log; then \ + echo "make release refusal did not name the release build (FAIL)"; cat $$log; fail=1; \ + else echo "make refuses CK_OSC_RECEIPT_TEST on a release build"; fi; \ + if $(MAKE) -s -n OUT=$(OUT)/host-mut/flip-mk-hw CK_OSC_RECEIPT_TEST=1 CK_HARDWARE_STAGING=1 CK_OWNER_PUBKEYS=$(KDIR)/tests/fixtures/owner/TEST-FIXTURE-owner-pubkeys.txt CK_MACHINE_ID=$(KDIR)/tests/fixtures/owner/TEST-FIXTURE-machine-id.txt full >$$log 2>&1; then \ + echo "make accepted CK_OSC_RECEIPT_TEST with CK_HARDWARE_STAGING (FAIL)"; fail=1; \ + elif ! grep -qF "cannot be combined with CK_HARDWARE_STAGING" $$log; then \ + echo "make hardware-staging refusal did not name CK_HARDWARE_STAGING (FAIL)"; cat $$log; fail=1; \ + else echo "make refuses CK_OSC_RECEIPT_TEST with CK_HARDWARE_STAGING"; fi; \ + if $(MAKE) -s -n OUT=$(OUT)/host-mut/flip-mk-svc CK_SERVICE=1 CK_OSC_RECEIPT_TEST=1 full >$$log 2>&1; then \ + echo "make accepted CK_OSC_RECEIPT_TEST with CK_SERVICE (FAIL)"; fail=1; \ + elif ! grep -qF "cannot be combined with CK_SERVICE" $$log; then \ + echo "make service refusal did not name CK_SERVICE (FAIL)"; cat $$log; fail=1; \ + else echo "make refuses CK_OSC_RECEIPT_TEST with CK_SERVICE"; fi; \ + if [ $$fail = 0 ]; then echo "CK_OSC_CODE_FLIP_GUARD: PASS"; else echo "CK_OSC_CODE_FLIP_GUARD: FAIL"; exit 1; fi + osc-receipt-mutants: $(OUT)/host/test_osc_receipt @mkdir -p $(OUT)/host-mut; fail=0; \ tags=$$(grep -o 'MUT([0-9]*)' $(KDIR)/artifact/osc_receipt.c | sort -u | wc -l); \ @@ -2568,7 +2689,7 @@ $(OUT)/host-san/test_pi5_rng: $(KDIR)/tests/test_pi5_rng.c $(PI5_RNG_SRCS) $(KDI FORCE: .PHONY: uefi-vars slot-loader slot-loader-check pi5-diag imac-diag imac-kernel imac-netldr imac-netboot-tool .PHONY: artifact-tier-pi5 artifact-tier-mutant -.PHONY: osc-receipt-mutants osc-receipt-release all full pi5 pi5-store pi5-infer pi5-unlock pi5-unlock-card pi5-fact pi5-agent pi5-lifecycle pi5-artifact artifact-card-mutant test sanitize context-mutant agent-cmd-mutant cortex-image handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants acpi-scan clean print-kcflags udp-echo tool store-image gpt-image cont-tool owner-gen fb-check continuity-mutants continuity-resolve-mutants FORCE +.PHONY: osc-receipt-mutants osc-receipt-release osc-code-flip-guard all full pi5 pi5-store pi5-infer pi5-unlock pi5-unlock-card pi5-fact pi5-agent pi5-lifecycle pi5-artifact artifact-card-mutant test sanitize context-mutant agent-cmd-mutant cortex-image handoff-mutant acpi-dev-mutant iort-mutants smmu-l2-mutants acpi-scan clean print-kcflags udp-echo tool store-image gpt-image cont-tool owner-gen fb-check continuity-mutants continuity-resolve-mutants FORCE # AIENOS-PI5 step 3 marker + Pi card GPT test (hosted; a file stands in for the card, QEMU cannot model the Pi SD host). PI5_MARKER_SRCS := $(KDIR)/core/pi5_marker.c $(KDIR)/dev/disk_part.c $(NATIVE)/disk/disk.c $(NATIVE)/disk/disk_file.c \ diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb index 1ca17647..cbe66c3e 100644 --- a/native/kernel/core/.crumb +++ b/native/kernel/core/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-28T23:15:29Z", + "compiled_at": "2026-10-30T12:19:24Z", "compiler": "crumb-compile/1", - "digest": "sha256:e6a371afcab6664b74ed49199722a013c18d962fc48b5907eeb18e14b3c35ba1", + "digest": "sha256:d4196275e1dc11d6b92d0fe9b90bbd9b7bbef17cd4ec63bc2fb09acfa7bd7b90", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 69, - "generated_at_commit": "832bcbd98fc59a6f7695aefa68223caa7e08df05", - "source_tree": "sha256:52f48edd6dbf5d3067f4db592b035ae0563de8518893343b3e6763083eb28317" + "generated_at_commit": "84ee2a02f78229167998d21a8ff03fe65bedb821", + "source_tree": "sha256:bbed7cef6c96eb3a715ddd76d2f893cdf2a86fea642a5d360f6f474aeb5ff49f" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/core/osc_admit.c b/native/kernel/core/osc_admit.c index 742bdf5d..6cbe5226 100644 --- a/native/kernel/core/osc_admit.c +++ b/native/kernel/core/osc_admit.c @@ -41,6 +41,33 @@ void ck_osh_all(void); #include "osc_unit_test_anchor.h" #include "osc_receipt_test_anchor.h" #endif +/* Variant 3 flips one admitted code byte after admission and restores it after + * launch (ck_osc_receipt_test_code_flip). The flip is its own opt-in, + * CK_OSC_RECEIPT_CODE_FLIP. The Makefile defines that macro only inside the + * CK_OSC_RECEIPT_TEST=1 block. CK_OSC_RECEIPT_TEST does not enable the flip, + * and neither does CK_SEED0B_TEST_ANCHOR: a compiler command that passes those + * two and skips native/kernel/Makefile fails below. CK_RELEASE_IMAGE (every + * build that is not the qualification anchor), CK_HARDWARE_STAGING and + * CK_SERVICE are positive production or release defines; the flip #errors + * when any of them is present. */ +#if defined(CK_OSC_RECEIPT_CODE_FLIP) && !defined(CK_OSC_RECEIPT_TEST) +#error "CK_OSC_RECEIPT_CODE_FLIP (TEST-ONLY post-admission code byte flip) requires CK_OSC_RECEIPT_TEST" +#endif +#if defined(CK_OSC_RECEIPT_TEST) && !defined(CK_OSC_RECEIPT_CODE_FLIP) +#error "CK_OSC_RECEIPT_TEST requires CK_OSC_RECEIPT_CODE_FLIP; CK_SEED0B_TEST_ANCHOR does not enable the post-admission code byte flip" +#endif +#if defined(CK_OSC_RECEIPT_CODE_FLIP) && defined(CK_RELEASE_IMAGE) +#error "CK_OSC_RECEIPT_CODE_FLIP (TEST-ONLY post-admission code byte flip) cannot be compiled when a production or release define is present: CK_RELEASE_IMAGE" +#endif +#if defined(CK_OSC_RECEIPT_CODE_FLIP) && defined(CK_HARDWARE_STAGING) +#error "CK_OSC_RECEIPT_CODE_FLIP (TEST-ONLY post-admission code byte flip) cannot be compiled when a production or release define is present: CK_HARDWARE_STAGING" +#endif +#if defined(CK_OSC_RECEIPT_CODE_FLIP) && defined(CK_SERVICE) +#error "CK_OSC_RECEIPT_CODE_FLIP (TEST-ONLY post-admission code byte flip) cannot be compiled when a production or release define is present: CK_SERVICE" +#endif +#if defined(CK_OSC_RECEIPT_CODE_FLIP) && !defined(CK_SEED0B_TEST_ANCHOR) +#error "CK_OSC_RECEIPT_CODE_FLIP (TEST-ONLY post-admission code byte flip) cannot be compiled into a release build" +#endif static unsigned seen, accepted, refused, oversize, announced; static struct osc_accept acc; /* ~5 KB: static, not on the kernel stack */ @@ -234,7 +261,7 @@ struct lt_step { int ws; /* 0 none, 1..2 which caller workspace */ uint64_t cap; const char *rcpt; /* receipt Store entry; NULL: the unit's own (lt_rcpt_for), "-": none */ - int variant; /* receipt policy variant for this launch (ck_osc_rcpt_variant): 0 qual, 1 release, 2 revoked key */ + int variant; /* TEST ONLY: 0 qual, 1 release, 2 revoked key, 3 changed code under qual policy */ }; /* The receipt of each launched unit: a receipt binds the IR and the code, so l02 (l01 with a bigger stack) shares @@ -255,6 +282,15 @@ static struct ck_osc_ws lt_ws[8] = { { lt_ws_mem1, 4 }, { lt_ws_mem2, 4 }, { lt_ { 0, 1 }, { lt_ws_mem1 + 8, 1 }, { 0, 1 }, { lt_ws_mem2, 4 } }; static unsigned lt_counts[5]; +#ifdef CK_OSC_RECEIPT_CODE_FLIP +/* TEST ONLY. One call flips one admitted code byte; the second call restores + * it. The launch between the two calls rehashes the private copy. */ +static __attribute__((noinline)) void ck_osc_receipt_test_code_flip(uint8_t *code_byte) +{ + *code_byte ^= 1; +} +#endif + static void lt_run(const struct lt_step *s) { for (unsigned u = 0; u < lt_n; u++) { @@ -286,8 +322,18 @@ static void lt_run(const struct lt_step *s) const char *rn = s->rcpt ? s->rcpt : lt_rcpt_for(s->unit); size_t rlen = 0; const uint8_t *rb = lt_streq(rn, "-") ? 0 : ck_osc_receipt_find(rn, &rlen); - ck_osc_rcpt_variant = s->variant; + ck_osc_rcpt_variant = s->variant == 3 ? 0 : s->variant; +#ifdef CK_OSC_RECEIPT_CODE_FLIP + /* Preserve the valid receipt and admitted view; alter only the bytes + * privately copied by the launcher, exercising its final rehash. */ + if (s->variant == 3) + ck_osc_receipt_test_code_flip(<_unit[u].bytes[lt_unit[u].acc.code_off]); +#endif ck_osc_launch(lt_unit[u].bytes, lt_unit[u].len, <_unit[u].acc, rb, rlen, &rq, &r, &info); +#ifdef CK_OSC_RECEIPT_CODE_FLIP + if (s->variant == 3) + ck_osc_receipt_test_code_flip(<_unit[u].bytes[lt_unit[u].acc.code_off]); +#endif ck_osc_rcpt_variant = 0; char rs[96], as[80]; ck_osc_result_str(&r, rs, sizeof rs); @@ -311,7 +357,7 @@ static void lt_run(const struct lt_step *s) hex(idh, info.rcpt.id, 8); ck_printf("osc_rcpt_launch: %s %s(%s) receipt=%s policy=%s -> %s receipt_id=%s revoked=%s ticks=%llu " "pages_mapped=%u page_tables_zeroed=%u slot_free=%u; QEMU (aarch64 virt), TEST signer, not physical\n", - s->unit, s->fn, as, rb ? rn : "none", vname[s->variant], rs, idh, + s->unit, s->fn, as, rb ? rn : "none", vname[s->variant == 3 ? 0 : s->variant], rs, idh, info.rcpt.revoked == OSC_RCPT_REVOKED_ID ? "receipt_id" : info.rcpt.revoked == OSC_RCPT_REVOKED_KEY ? "signer_key" : "-", (unsigned long long)r.ticks, info.pages_mapped, (unsigned)info.tables_zeroed, @@ -355,8 +401,10 @@ static void rt_all(void) { "a01_valid_min.unit", "add", 2, { 15, 16 }, 0, 0, 0, "n_deps.rcpt", 0 }, { "a01_valid_min.unit", "add", 2, { 16, 17 }, 0, 0, 0, "n_checker.rcpt", 0 }, { "a01_valid_min.unit", "add", 2, { 17, 18 }, 0, 0, 0, "a01.owner.rcpt", 1 }, + { "a01_valid_min.unit", "add", 2, { 18, 19 }, 0, 0, 0, "a01.rcpt", 3 }, { "a01_valid_min.unit", "add", 2, { 20, 22 }, 0, 0, 0, "a01.rcpt", 0 }, }; + ck_printf("osc_rcpt_rehash: TEST-ONLY post-admission code byte flip; QEMU (aarch64 virt), TEST signer, not physical\n"); ck_printf("osc_rcpt_selftest: launches=%u unit=a01_valid_min.unit; QEMU (aarch64 virt), TEST signer, not physical\n", (unsigned)(sizeof steps / sizeof steps[0])); for (unsigned i = 0; i < sizeof steps / sizeof steps[0]; i++) diff --git a/scripts/.crumb b/scripts/.crumb index d40626a8..2b332246 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-30T05:15:53Z", + "compiled_at": "2026-10-30T11:55:22Z", "compiler": "crumb-compile/1", - "digest": "sha256:8650bf3aae02e1f11fe999a3cd8c1399df071d318e6ecb642bc366a282e75fbf", + "digest": "sha256:2eeb83a186f413cd87d904a1bff118758e10bc3921c288762c2e07d87d21e503", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 125, - "generated_at_commit": "94b77f6c2c3a43fbd90f7c3d08169dee1ae50fcf", - "source_tree": "sha256:3b7aed190f275eb76bff736da2bf4d66c1dc46388fe09cec78042748b0f0146d" + "generated_at_commit": "5566de422237b0ec4616289cd87dda907a2241b6", + "source_tree": "sha256:b69a48f00af9067820610a6cd768685c79386bdf2b9d9d64aa1bf0d79ab98714" }, "owner_lane": "", "provenance": { diff --git a/scripts/qemu_ck_osc_receipt_test.sh b/scripts/qemu_ck_osc_receipt_test.sh index 4e20d0ad..8c6ebf31 100755 --- a/scripts/qemu_ck_osc_receipt_test.sh +++ b/scripts/qemu_ck_osc_receipt_test.sh @@ -25,7 +25,7 @@ # # One unit (a01_valid_min.unit) and fourteen receipts are written into the sealed C Store of a GPT boot disk # image. One boot of the qualification image built with CK_SEED0B_TEST_ANCHOR=1 CK_OSC_LAUNCH_TEST=1 -# CK_OSC_RECEIPT_TEST=1 launches a01 add(a, b) eighteen times, each time with one receipt or none, and prints one +# CK_OSC_RECEIPT_TEST=1 launches a01 add(a, b) nineteen times, each time with one receipt or none, and prints one # "osc_rcpt_launch:" line each. This gate checks: # with the valid receipt the unit RETURNS the exact value (first and last launch), and with the owner receipt in # release mode (aienos#387); @@ -136,7 +136,7 @@ for rf in "${files[@]:1}"; do check "${serial}" "${r}.rcpt stored from the Store (bytes=${b})" "^osc_receipt: ${r//./\\.}\\.rcpt STORED bytes=${b} id=${id} " done check "${serial}" "receipt totals: 14 seen, 14 stored" "^osc_receipts: seen=14 stored=14 dropped=0 " -check "${serial}" "self-test announces 18 launches" "^osc_rcpt_selftest: launches=18 unit=a01_valid_min\\.unit; " +check "${serial}" "self-test announces 19 launches" "^osc_rcpt_selftest: launches=19 unit=a01_valid_min\\.unit; " label='QEMU \(aarch64 virt\), TEST signer, not physical' a=a01_valid_min.unit @@ -167,11 +167,12 @@ rline "receipt naming firmware: RECEIPT_WRONG_FIRMWARE (81)" '14,15' n_firmware. rline "receipt with a dependency: RECEIPT_DEPENDENCIES_MISMATCH (88)" '15,16' n_deps.rcpt qualification "$(ref 88 DEPENDENCIES_MISMATCH)" - rline "receipt from an unlisted checker: RECEIPT_UNTRUSTED_CHECKER (86)" '16,17' n_checker.rcpt qualification "$(ref 86 UNTRUSTED_CHECKER)" - rline "owner receipt (signed on the owner YubiKey) in release mode: the unit runs, add(17,18) RETURNED 35" '17,18' a01.owner.rcpt release 'RETURNED value=35' - run +rline "valid receipt with code changed after admission: CODE_HASH_MISMATCH (16), nothing mapped or executed" '18,19' a01.rcpt qualification 'REFUSED_AT_ADMISSION code=16 name=CODE_HASH_MISMATCH' - rline "after every refusal, the valid receipt still runs the unit: add(20,22) RETURNED 42" '20,22' a01.rcpt qualification 'RETURNED value=42' - run -check "${serial}" "summary: 3 returned, 15 refused" "^osc_rcpt_launches: returned=3 trapped=0 refused=15 unknown=0; ${label}\$" +check "${serial}" "summary: 3 returned, 16 refused" "^osc_rcpt_launches: returned=3 trapped=0 refused=16 unknown=0; ${label}\$" nl=$(grep -c '^osc_rcpt_launch: ' "${serial}" || true) names=$(grep -oE '^osc_rcpt_launch: .* name=RECEIPT_[A-Z_]+' "${serial}" | sed -E 's/.*name=//' | sort | uniq -d | tr '\n' ' ') -[[ "${nl}" == 18 ]] && pass "exactly 18 receipt launch lines" || fail "receipt launch lines (${nl} of 18)" +[[ "${nl}" == 19 ]] && pass "exactly 19 receipt launch lines" || fail "receipt launch lines (${nl} of 19)" # REVOKED appears twice on purpose (receipt id, signer key), told apart by the revoked= column [[ "${names}" == "RECEIPT_REVOKED " ]] && pass "every other refusal names a reason of its own" || fail "refusal reasons repeated: ${names}" if grep -E '^osc_launch: ' "${serial}" | grep -q .; then fail "a C3-3a launch line appeared in the receipt self-test"; else pass "only the receipt self-test ran"; fi ```