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