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/e75c4670a19dbc64 # 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#316 (code only) closed derived `e75c4670a19dbc64` #316 Imported from GitHub aien-dev/aienux#316 (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 `10c2ea7d7a6df47ca68bce5f208823d25e55279d` · Head `f13b2df3294473b3a81ff4ad98a6399629a7c1f2` ### Apply it ``` git checkout -b patch-e75c4670a19dbc64 10c2ea7d7a6df47ca68bce5f208823d25e55279d curl -fsSL https://interplane.io/drakestapleton/aienux/patches/e75c4670a19dbc64.patch | git am ``` Raw patch (mbox) · 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 316 f13b2df3294473b3a81ff4ad98a6399629a7c1f2 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aienux","number":316,"url":"https://github.com/aien-dev/aienux/pull/316","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:12Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index f1c84e0b..1f1965c5 100644 --- a/.crumb +++ b/.crumb @@ -27,33 +27,33 @@ "purpose": "Directory crates. Purpose not yet described by a human." }, { - "digest": "6098d439031bb73f0defd23222fe41ed8786929160f9285c456c10c70891361d", - "last_commit": "1feaca1", + "digest": "c5b8b0f4bc3287195f8af9d001dcacfbbcc2247ff59505c6cc8f9fd078c6baaf", + "last_commit": "b9baac8", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "128178307620da9c5e813c4d6eb39085038d7bee25ac18ff8b0e8fcffb0ae7b7", - "last_commit": "638d78e", + "digest": "722aa527ceed838b63623647060db036571772cfd40864677e37621679baa417", + "last_commit": "b9baac8", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { - "digest": "f4c0b7b6f51641d9b7a64cc22dc53abd288f1ef112191df2fec9450529de4922", - "last_commit": "638d78e", + "digest": "2e11a9899bf4b8d979c08da48c4ab1610e58b4fcd6d33c190a9f9980147c4a71", + "last_commit": "b9baac8", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." } ], - "children_root": "sha256:d8c403e428cb92c21b6e55b7c85146eb3c1fb873bd28bf61808a59093c736a46", - "compiled_at": "2026-10-12T08:47:00Z", + "children_root": "sha256:4f007f02a0d70e763ba16618d9a80840ade185d66b9156c8d8f39266c8d82dd4", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:3830cc8edbbdf466dc680a6e708799737fc22e2cca1d7709f620c3831175f378", + "digest": "sha256:1aec764b9fb6dfe44de533ef107ba5addbaded666a7bdbe1564407b5fc791c7c", "evidence_files": 155, "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7", "files": 3085, - "generated_at_commit": "638d78e94611546f909e559c035e640d06d2857f", - "source_tree": "sha256:18873dd280be1ba176274f68395f84d6589637a8f240ed2f4ab0660b01e2678c" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:63e4b1ba16160c6c7da976cbdd0ffda15c06a12ac93cdcdc83e68f38a3d83143" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index 63965560..b3f5bab7 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -17,8 +17,8 @@ "generated": { "children": [ { - "digest": "1a285e00bf8cae48459d19cda7b8915b086070f5cc165750ae739c319af7139c", - "last_commit": "a9d120b", + "digest": "3f2495475b3364d5c9fbf79ebe0bfef1b86202f5cea6e85f931148f8101b5809", + "last_commit": "b9baac8", "name": "adr", "purpose": "Directory docs/adr. Purpose not yet described by a human." }, @@ -29,15 +29,15 @@ "purpose": "Directory docs/crumbs. Purpose not yet described by a human." } ], - "children_root": "sha256:f8947b77a3ad5a0cef155aa9d8503c539aaad3bd8eac05404b62342ee7117cef", - "compiled_at": "2026-10-12T05:32:10Z", + "children_root": "sha256:1ccad6e28aaeef112ad4a1a3bb25117a4e0730e1796af18c611c579ced66f198", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:6098d439031bb73f0defd23222fe41ed8786929160f9285c456c10c70891361d", + "digest": "sha256:c5b8b0f4bc3287195f8af9d001dcacfbbcc2247ff59505c6cc8f9fd078c6baaf", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 69, - "generated_at_commit": "a9d120b2e91893bb80a378dc746cf0a274e42878", - "source_tree": "sha256:c84b5e0fc18e3574fc7c03a837309c6f8d34576c3e204363010d1b0feabb1d3b" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:c17458ecf76cb17d6f5fabed27cb98a2bb6609ca4632e07a77b8e93eaa677c1e" }, "owner_lane": "", "provenance": { diff --git a/docs/adr/.crumb b/docs/adr/.crumb index 9fbabf11..2282c601 100644 --- a/docs/adr/.crumb +++ b/docs/adr/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T05:32:10Z", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:1a285e00bf8cae48459d19cda7b8915b086070f5cc165750ae739c319af7139c", + "digest": "sha256:3f2495475b3364d5c9fbf79ebe0bfef1b86202f5cea6e85f931148f8101b5809", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 22, - "generated_at_commit": "a9d120b2e91893bb80a378dc746cf0a274e42878", - "source_tree": "sha256:5b7d0ec9086f3b8d5e0b557bb5eba5c26d64517bb3b28d0cc4aba61f35227b0e" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:43de31d39aa29f4eb258d1cb160b42ab5cb6076bf2ce41e9100e7c41994ab909" }, "owner_lane": "", "provenance": { diff --git a/docs/adr/0017-m5-key-hierarchy-and-encrypted-store.md b/docs/adr/0017-m5-key-hierarchy-and-encrypted-store.md index c62dd5a9..4a21888a 100644 --- a/docs/adr/0017-m5-key-hierarchy-and-encrypted-store.md +++ b/docs/adr/0017-m5-key-hierarchy-and-encrypted-store.md @@ -165,7 +165,7 @@ reserved (16 B) - Recovery KEK (raw-secret profile): `m5_recovery_kek` = HKDF-SHA256(salt = slot.salt, ikm = 32-byte secret, info = `AIENOS/M5/RECOVERY-KEK-V1`, 32). HKDF-Extract is `HMAC(salt || 0^16, ikm)`, bit-identical to RFC 5869 for a 16-byte salt (test vector in `m5_test.c`). - Keyslot AAD in C binds `store_uuid, slot_id, slot_type, key_epoch` (`AIENOS-M5-KEYSLOT-V2`), a superset of the Rust reference; C is authoritative. - The kernel (`ck_store_unlock_boot`) creates the manifest at genesis in the same first transaction as the boot record (index 0 reserved Empty for the TPM slot, index 1 = Recovery_RawSecret, slot_id 1, `active_key_epoch` 1), and derives PRODUCTION-class subkeys with owner hierarchy generation = `active_key_epoch`. -- Not yet: TPM Slot 0 (BLOCKED_HARDWARE), key rotation (section 2.7), binding `keyslot_manifest_id` into the SecurityManifest, Argon2id profile. +- Not yet: TPM Slot 0 (BLOCKED_HARDWARE), key rotation (section 2.7), Argon2id profile. The `keyslot_manifest_id` binding into the SecurityManifest is P04 cut 2a (section 2.5.1). ### 2.5 SecurityManifest (`kind = 22`) @@ -194,6 +194,14 @@ $$\text{root\_mac} = \text{HMAC-SHA256}(K_{\text{root\_auth}}, \text{"AIENOS-M5- To break the content-addressing dependency cycle, `SecurityManifest` intentionally omits the current generation's `commit_record_id`. The Store transaction engine links `SecurityManifest` into the Catalog, whose root is referenced by the CommitRecord. +#### 2.5.1 Implementation note (C kernel, P04 cut 2a, 2026-10-12) + +- Codec: `native/m5` `m5_secman_seal` / `m5_secman_open` (256 bytes, Rust v1 layout, `root_mac` under `k_root_auth`; identity class and owner hierarchy generation are bound through the key, not wire fields). +- The kernel boot stage (`native/kernel/svc/store_boot.c`, `run_policy_ex`) commits one SecurityManifest in **every boot transaction**, next to the boot record (and the KeySlotManifest at genesis). In the C sealed store it is a kind-22 **sealed envelope** (the store admits only the KeySlotManifest in plaintext), so the transaction record binds it and `root_mac` authenticates it a second time under `k_root_auth`. +- Fields as written: `generation` = the generation the transaction creates; `security_sequence` = previous + 1 (1 at genesis); `previous_security_manifest_id` = the Store ObjectId of the manifest it supersedes (zero at genesis); `key_epoch` = the owner hierarchy generation of the open keys (`active_key_epoch`, 1); `keyslot_manifest_id` = the KeySlotManifest ObjectId (`sv1_object_id` of the kind-21 bytes at genesis, the keyed open's bound `keyslot_sid` later; zero on a TEST-key Store, which has none); `epoch` = `generation`, because the C sealed store's anti-rollback anchor (`torn_slot`, section 2.6 step 3) counts Store generations; `agent_root_id`, `continuity_manifest_id`, `migration_manifest_id` = zero (not yet linked). +- On every open the newest manifest is read back and must: verify under the open keys; name this Store; bind exactly the keyslot the keyed open bound; carry the open keys' epoch; carry the generation of the transaction that committed it; carry a `security_sequence` equal to the number of manifests on the Store. A Store with history but no manifest, or any failed check, is refused (`CK_SB_E_SECMAN`, "SecurityManifestRefused") before the boot record is written, and the keys are wiped. Evidence: `svc/tests/stage_test.c` `test_secman`, LIFECYCLE gate rows 182-183. +- Limits: only the boot transaction writes a manifest (approve, continuity and journal commits do not advance `security_sequence`); rotation (section 2.7) and TPM Slot 0 (section 2.8) remain open. + --- ### 2.6 Anti-Rollback Semantics & Security Epochs diff --git a/native/.crumb b/native/.crumb index 2d79ea98..aa33fc84 100644 --- a/native/.crumb +++ b/native/.crumb @@ -79,8 +79,8 @@ "purpose": "Directory native/disk. Purpose not yet described by a human." }, { - "digest": "f97181d14fe839aa4d67dd8e69ab37ca6fdbbd22a1eb18aa147206719c4672fc", - "last_commit": "638d78e", + "digest": "e360d366f6232a156213aa656e6b6487ed49286ba424f070b65c933fb64d4c5e", + "last_commit": "b9baac8", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, @@ -109,15 +109,15 @@ "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:59306304f759d308be13771cb521c5d1c11d75367ff972b4355adc07a9c95095", - "compiled_at": "2026-10-12T08:47:00Z", + "children_root": "sha256:e926c5cbd12204494a193fa90dd78dddb55c6c0f507eefd707d3651d45a67fb3", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:128178307620da9c5e813c4d6eb39085038d7bee25ac18ff8b0e8fcffb0ae7b7", + "digest": "sha256:722aa527ceed838b63623647060db036571772cfd40864677e37621679baa417", "evidence_files": 4, "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335", "files": 469, - "generated_at_commit": "638d78e94611546f909e559c035e640d06d2857f", - "source_tree": "sha256:dc3e2fe409b5acc97201a2303ea16b4bdbd9d81d72a9af6b91a36801f6b7275d" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:54b67a29df90dbe9074b7e226658e49b64f3ff6c1a2ad7e4a2df31bd72e1cf4f" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/.crumb b/native/kernel/.crumb index 380096d7..4433e4ab 100644 --- a/native/kernel/.crumb +++ b/native/kernel/.crumb @@ -58,7 +58,7 @@ }, { "digest": "d442b49555533f077c87c907efa0fea22b5b20ef93bb1650adcfcce4d4ce50ed", - "last_commit": "638d78e", + "last_commit": "10c2ea7", "name": "core", "purpose": "Directory native/kernel/core. Purpose not yet described by a human." }, @@ -81,14 +81,14 @@ "purpose": "Directory native/kernel/mm. Purpose not yet described by a human." }, { - "digest": "e303ca254129aec54d0055028a849d1e0b03d54a0b44c2b7f7f9d766ccf8819d", - "last_commit": "638d78e", + "digest": "28548cc5bc6f6d137cfb2bbf7a3bbba09ac92ee3d0c2f34eb08772b92ac64e8b", + "last_commit": "b9baac8", "name": "svc", "purpose": "Directory native/kernel/svc. Purpose not yet described by a human." }, { "digest": "83457528f2132fa686bb428663db2585a32f3a731dddb30ea0c2295a28c45656", - "last_commit": "638d78e", + "last_commit": "10c2ea7", "name": "tests", "purpose": "Directory native/kernel/tests. Purpose not yet described by a human." }, @@ -99,15 +99,15 @@ "purpose": "Directory native/kernel/tools. Purpose not yet described by a human." } ], - "children_root": "sha256:a28f68361f11832ef2f17c13acca5da7f049f69e897f6a1b41641d31743a7e9c", - "compiled_at": "2026-10-12T08:47:00Z", + "children_root": "sha256:3bb81381da85d2c00d2ea1e9faaf1cd112557410ebe1a5e5c647300395531069", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:f97181d14fe839aa4d67dd8e69ab37ca6fdbbd22a1eb18aa147206719c4672fc", + "digest": "sha256:e360d366f6232a156213aa656e6b6487ed49286ba424f070b65c933fb64d4c5e", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 305, - "generated_at_commit": "638d78e94611546f909e559c035e640d06d2857f", - "source_tree": "sha256:f03c549ca78b54cf26590dfb6e922c3d103c05b2338c880ad1c97915df6951f9" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:3dfe809f98dfe05d9b04385b81abacbd80827e977fbd5ddc4cf4cef243bcbae2" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index d355404a..d2eba1e4 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -832,7 +832,7 @@ are this adapter's choices (UNVERIFIED against a frozen contract). (5) The reque bytes; the contract's exact digest input is not defined (UNVERIFIED). (6) The "task" is the adapter's session; the EL0 shell units hold no capability (caps=0) and the check is made by the kernel-side adapter. -## LIFECYCLE: resident production lifecycle (native v1 plan P03, P04 cut 1, P05 cut 1, P06 cuts 2-4; C-only) -> CK `LIFECYCLE` (scripts/qemu_ck_lifecycle_test.sh) +## LIFECYCLE: resident production lifecycle (native v1 plan P03, P04 cuts 1-2a, P05 cut 1, P06 cuts 2-4; C-only) -> CK `LIFECYCLE` (scripts/qemu_ck_lifecycle_test.sh) The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_HARDWARE_STAGING`, refused with every TEST-only flag) links `core/lifecycle.c` + `core/lifecycle_fsm.c`: after every boot stage the kernel serves bounded operator requests on the serial console (states init, locked, ready, serve, quiesce, stop; verbs status, unlock, task , prompt , approve, deny, cancel, recall, evidence, help, shutdown; one 96-byte line, one 48-byte task or prompt, one 256-byte reply, one pending proposal at a time) until `shutdown`, then runs the stop order (Store closed, NVMe normal shutdown + bus master off + SMMU stream to abort, final report, reset) instead of resetting at once. The diagnostic images are unchanged (the weak `ck_lifecycle_run` is absent). The production key source still refuses (no in-kernel K_vol unwrap, P04), so the production service image comes up LOCKED. The TEST-ONLY `CK_SERVICE_TEST_KEYS=1` image (`full-service-testkeys/`, refused with `CK_HARDWARE_STAGING`) opens the Store with the TEST keys so the ready/serve/commit paths run in QEMU. Host test: `tests/test_lifecycle.c` (`make test`, 79 checks on the state machine and decoder). P06 cut 2 (rows 174-176): a service image built with `CK_INFER_LIB` keeps the model and one bounded session resident from boot to the stop order (`core/infer.c` resident mode, `CK_INFER_RESIDENT`); `prompt ` generates a bounded reply between whose steps only `cancel` is accepted, the reply becomes the pending proposal and `approve` commits it as one sealed reply object (kind 0x5231 'R1': `aienos.reply.v1`, the prompt and the reply); `recall` reads the newest approved note or reply back through the sealed Store, so a cold boot answers from the disk and never from memory. QEMU only: the model arrives over the TEST-ONLY fw_cfg channel and `CK_INFER_LIB` cannot combine with `CK_HARDWARE_STAGING`, so the hardware service image still has no inference (the MODEL.MAP boot-disk source is the hardware path, P06 next cut). QEMU qualifies nothing physical. @@ -862,3 +862,5 @@ The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_ | 179 | P06 cut 4, remembered facts (the N3 memory-only fact) on the test-keys boot (boot 2): `remember ` (1..48 bytes, refused LOCKED, allowed READY and SERVE, never changes the state or the pending task) opens the Cortex journal lazily (`lifecycle: cortex open records=0 chunks=1 journal_bytes=32 ... chain=ok`: one sealed header transaction) and appends one CX_CLAIM record (one sealed transaction, durable before `lifecycle: remembered id=1 t=1 store_gen=N bytes=18 text="prefer short notes"`); `facts` in the same boot lists it (`lifecycle: fact id=1 t=1 ...`, `facts records=1 shown=1 journal_bytes=192 chain=ok`: every digest re-checked by `cx_recall_id`, the chain by `cx_verify_chain`); `evidence ... remembers=1 facts=1 cortex=open records=1`; stop order closes the journal first (`lifecycle: cortex closed records=1 appends=2 ...` before the stop order line; the CK_CX_HEAP_PAGES frames are returned) | LIFECYCLE | QEMU PASS (2026-10-12 08:30-08:46Z, tree 61f4e66: 150 rows, both verdicts PASS; observed `remembered id=1 t=1 ... bytes=18`, `facts records=1 shown=1 ... chain=ok`, `cortex closed records=1 appends=2`; hardware NOT_RUN) | | 180 | the same two verbs on the production Store (boot 3, recovery keyslot genesis, after the approved note at generation 4): journal header at generation 5 (`cortex open ... store_gen=5`), the fact at generation 6 (`remembered id=1 t=1 store_gen=6`), `facts records=1 shown=1`, evidence `requests=8 refused=1 ... last_commit_gen=4 ... remembers=1 facts=1 cortex=open records=1`, stop order `requests=9`; no `REFUSED verb=(remember|facts)` | LIFECYCLE | QEMU PASS (2026-10-12, tree 61f4e66: `cortex open records=0 chunks=1 journal_bytes=32 store_gen=5`, `remembered id=1 t=1 store_gen=6`, evidence `remembers=1 facts=1 cortex=open records=1`; hardware NOT_RUN) | | 181 | cold production boot on the same disk (boot 4): the Store opens at generation 6, commits the boot record at 7 and the continuity resume at 8 (rows 169/172 unchanged otherwise); `facts` alone (`cortex open records=1 chunks=2 journal_bytes=192 store_gen=8 ... chain=ok`) answers `fact id=1 t=1 store_gen=6 text="prefer short notes"` from the disk; the fact is never typed in that boot (no `> remember`, no `lifecycle: remembered`); evidence `requests=6 refused=1 ... remembers=0 facts=1 cortex=open records=1`; `cortex closed records=1 appends=0` before the stop order; a disk without a journal answers `facts none cortex=none records=0` without creating one (host FSM test: 95 checks) | LIFECYCLE | QEMU PASS (2026-10-12, tree 61f4e66: `cortex open records=1 chunks=2 journal_bytes=192 store_gen=8 chain=ok`, `fact id=1 t=1 store_gen=6`, no `remember` typed, evidence `remembers=0 facts=1`, `cortex closed appends=0 reads=1`; hardware NOT_RUN) | +| 182 | P04 cut 2a, SecurityManifest (ADR 0017 section 2.5) on every boot transaction (`svc/store_boot.c` run_policy_ex: kind 22 sealed envelope, root_mac under k_root_auth; generation = the generation the transaction creates, security_sequence = previous + 1, previous_security_manifest_id = the superseded manifest, key_epoch = the open keys' owner hierarchy generation, keyslot_manifest_id = the KeySlotManifest ObjectId or zero, epoch = generation): host `test_secman` in `svc/tests/stage_test.c`: TEST-key Store sequences 1, 2, 3 over three boots with `keyslot=none`; a forged newer manifest sealed under the right keys with a sequence that is not the manifest count, another key_epoch, or a keyslot the Store does not have refuses the next boot (`CK_SB_E_SECMAN`, proof keyed, keys wiped, disk bytes unchanged); a well-formed newer manifest is accepted and the next boot writes sequence 3; the production Store binds the keyslot at genesis (`sv1_object_id` of the kind-21 bytes committed in the same transaction) and on every resume (`keyslot_sid` of the keyed open). QEMU: the TEST-key boot 2 prints `store: security manifest sequence=1 generation=2 keyslot=none previous=genesis` | LIFECYCLE (host + QEMU) | PASS (host 2026-10-12: CK_STAGE_HOST checks=817, stage-sanitize 817, stage-free objects=45; QEMU 2026-10-12 on tree 10c2ea7 + this cut: 154 rows, row 182 observed exactly; hardware NOT_RUN) | +| 183 | production Store: genesis boot 3 prints `store: security manifest sequence=1 generation=2 keyslot=bound previous=genesis`; cold resume boot 4 prints `sequence=2 generation=7 keyslot=bound previous=linked` (the manifest read back from the disk verified under K_root_auth, bound exactly the keyslot the keyed open bound, carried key_epoch 1, the generation that committed it and the manifest count); no `SecurityManifest` refusal in any boot. Limits: only the boot transaction writes a manifest (approve, continuity and journal commits do not advance security_sequence); agent_root_id, continuity_manifest_id and migration_manifest_id stay zero; TPM Slot 0 BLOCKED_HARDWARE; no key rotation; hardware NOT_RUN | LIFECYCLE | QEMU PASS (2026-10-12: 154 rows, AIENOS_CK_LIFECYCLE and AIENOS_CK_LIFECYCLE_INFER PASS; boot 3 `sequence=1 generation=2 keyslot=bound previous=genesis`, boot 4 `sequence=2 generation=7 keyslot=bound previous=linked`, no refusal line; hardware NOT_RUN) | diff --git a/native/kernel/svc/.crumb b/native/kernel/svc/.crumb index 180cd5eb..c7620545 100644 --- a/native/kernel/svc/.crumb +++ b/native/kernel/svc/.crumb @@ -23,21 +23,21 @@ "purpose": "Directory native/kernel/svc/compat. Purpose not yet described by a human." }, { - "digest": "88c4fc1ed3ed47dc767deb9c59923934ca9b73b66aabec84a2c3e19cebdf8283", - "last_commit": "543c1fc", + "digest": "c9cfdfae82f6668d32a1378c6ce99fbc5fd7b3a0f47cf3986ee0a8cf3ba40032", + "last_commit": "b9baac8", "name": "tests", "purpose": "Directory native/kernel/svc/tests. Purpose not yet described by a human." } ], - "children_root": "sha256:c08ae620be123d4ae06a01d1830984c81570c3c44fc528987cee2ad37c3c2ca9", - "compiled_at": "2026-10-12T08:47:00Z", + "children_root": "sha256:5a1483582a1fbfc20be8ad0417b7e930888cf40344fe2dca199fa0b7c4643b3c", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:e303ca254129aec54d0055028a849d1e0b03d54a0b44c2b7f7f9d766ccf8819d", + "digest": "sha256:28548cc5bc6f6d137cfb2bbf7a3bbba09ac92ee3d0c2f34eb08772b92ac64e8b", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 41, - "generated_at_commit": "638d78e94611546f909e559c035e640d06d2857f", - "source_tree": "sha256:38af02cb9fe0c5b69d636d71bbd312e91f5c152f0b7f422fa1ccbd77e7ff5db3" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:4285732e09f59ff61427199f2360237047dd00f26c296d9db0f0a96b0964904a" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/svc/store_boot.c b/native/kernel/svc/store_boot.c index ce3bb6d4..91e0a622 100644 --- a/native/kernel/svc/store_boot.c +++ b/native/kernel/svc/store_boot.c @@ -6,6 +6,7 @@ #include "disk_layout.h" #include "m5.h" #include "sha256.h" +#include "store_v1.h" #include "store_crash.h" #include "continuity_boot.h" #ifdef CK_SERVICE @@ -121,6 +122,13 @@ static int fail(ck_store_report *r, const char *proof, const char *step, int rc) } /* Blank = anchor units and the first two Store units read back all zero. */ +static int bytes_differ(const uint8_t *a, const uint8_t *b, size_t n) +{ + int diff = 0; + for (size_t i = 0; i < n; i++) diff |= a[i] ^ b[i]; + return diff != 0; +} + static int is_blank(const disk_dev *d, uint32_t bpu, uint8_t *buf, int *blank) { *blank = 1; @@ -154,6 +162,13 @@ static const char *classify(int rc) /* Workspace lives across boots of the host test; the kernel uses it once. */ static ss_workspace *g_ws; static ss_store *g_ss; + +/* SecurityManifest refusal: the Store is not served and the keys are wiped. */ +static int secman_refuse(ck_store_report *r, const char *step) +{ + bz(&g_ss->keys, sizeof g_ss->keys); + return fail(r, "keyed", step, CK_SB_E_SECMAN); +} #ifdef CK_SERVICE static int g_service_open; /* Store open for the service lifetime (core/lifecycle.c) */ static int g_service_locked_rc; /* last production key source refusal */ @@ -261,14 +276,76 @@ static int run_policy_ex(const disk_dev *d, const ss_keys *keys, const uint8_t u return fail(r, "record", "store has history but no boot record", -1); } + /* SecurityManifest (ADR 0017 section 2.5, P04 cut 2a): the newest + * kind-22 claim must verify under these keys and bind this Store, its + * keyslot and its key epoch; its security_sequence equals the number of + * manifests on the Store (every boot transaction writes exactly one). */ + m5_secman sm; + uint8_t sm_prev[32], zero32[32]; + uint32_t nsecman = 0; + int sm_best = -1; + bz(&sm, sizeof sm); + bz(sm_prev, sizeof sm_prev); + bz(zero32, sizeof zero32); + for (uint32_t k = 0; k < g_ss->nclaims; k++) { + const ss_claim *c = &g_ws->claims[k]; + if (c->c.obj.object_kind != CK_SECMAN_KIND) continue; + nsecman++; + if (sm_best < 0 || c->c.store_generation > g_ws->claims[sm_best].c.store_generation) sm_best = (int)k; + } + if (sm_best >= 0) { + uint8_t smb[M5_SECMAN_LEN]; + size_t len = 0; + uint16_t kind = 0; + bcp(sm_prev, g_ws->claims[sm_best].sid, 32); + rc = ss_read(g_ss, sm_prev, smb, sizeof smb, &len, &kind); + if (rc) return fail(r, classify(rc), "read SecurityManifest", rc); + if (len != M5_SECMAN_LEN || kind != CK_SECMAN_KIND || m5_secman_open(smb, len, keys->k_root_auth, &sm) != 0) + return secman_refuse(r, "SecurityManifest malformed or not under these keys"); + if (bytes_differ(sm.store_uuid, g_ss->uuid, 16)) return secman_refuse(r, "SecurityManifest names another Store"); + if (bytes_differ(sm.keyslot_manifest_id, g_ss->has_keyslot ? g_ss->keyslot_sid : zero32, 32)) + return secman_refuse(r, "SecurityManifest does not bind this Store's KeySlotManifest"); + if (sm.key_epoch != keys->key_generation) return secman_refuse(r, "SecurityManifest key_epoch differs from the open keys"); + if (sm.generation != g_ws->claims[sm_best].c.store_generation) + return secman_refuse(r, "SecurityManifest generation differs from the transaction that committed it"); + if (sm.security_sequence != nsecman) return secman_refuse(r, "SecurityManifest security_sequence is not the manifest count"); + r->secman_prev = 1; + } else if (!r->formatted && r->gen_open > 1) { + return secman_refuse(r, "store has history but no SecurityManifest"); + } + r->boot_count_new = r->boot_count_prev + 1; bz(rec, sizeof rec); bcp(rec, "AIENBOOT", 8); put32(rec + 8, CK_BOOT_VERSION); put64(rec + 16, r->boot_count_new); for (size_t i = 0; i < CK_BOOT_COMMIT_MAX && commit[i]; i++) rec[24 + i] = (uint8_t)commit[i]; - ss_object objs[2] = {{CK_BOOT_KIND, CK_BOOT_VERSION, rec, sizeof rec}, {0, 0, 0, 0}}; - size_t nobjs = 1; + /* The SecurityManifest of this transaction (sequence previous + 1). */ + uint8_t smb_new[M5_SECMAN_LEN]; + { + m5_secman n; + bz(&n, sizeof n); + bcp(n.store_uuid, g_ss->uuid, 16); + n.generation = r->gen_open + 1; + n.security_sequence = sm.security_sequence + 1; + n.epoch = n.generation; + n.key_epoch = keys->key_generation; + bcp(n.previous_security_manifest_id, sm_prev, 32); + if (genesis_obj && r->formatted) { + if (sv1_object_id(genesis_obj->kind, genesis_obj->version, genesis_obj->bytes, genesis_obj->len, + n.keyslot_manifest_id) != 0) + return fail(r, "commit", "KeySlotManifest ObjectId", -1); + } else if (g_ss->has_keyslot) { + bcp(n.keyslot_manifest_id, g_ss->keyslot_sid, 32); + } + if (m5_secman_seal(&n, keys->k_root_auth, smb_new) != 0) return fail(r, "commit", "seal SecurityManifest", -1); + r->secman_seq = n.security_sequence; + r->secman_keyslot = bytes_differ(n.keyslot_manifest_id, zero32, 32); + } + ss_object objs[3] = {{CK_BOOT_KIND, CK_BOOT_VERSION, rec, sizeof rec}, + {CK_SECMAN_KIND, 1, smb_new, M5_SECMAN_LEN}, + {0, 0, 0, 0}}; + size_t nobjs = 2; if (genesis_obj && r->formatted) objs[nobjs++] = *genesis_obj; #ifdef CK_TEST_STORE_CRASH ck_store_crash_opened(r->gen_open); @@ -451,6 +528,7 @@ static const char *err_name(int rc) if (rc == CK_SB_E_ENTROPY) return "EntropyRefused"; if (rc == CK_SB_E_KEYSLOT_BAD) return "KeyslotManifestUnusable"; if (rc == CK_SB_E_CONTINUITY) return "ContinuityRefused"; + if (rc == CK_SB_E_SECMAN) return "SecurityManifestRefused"; return "error"; } @@ -487,6 +565,9 @@ void store_boot_print(const ck_store_report *r) rb_name(r->rb)); ck_printf("store: committed generation=%llu boot_count=%llu\n", (unsigned long long)r->gen_commit, (unsigned long long)r->boot_count_new); + ck_printf("store: security manifest sequence=%llu generation=%llu keyslot=%s previous=%s\n", + (unsigned long long)r->secman_seq, (unsigned long long)r->gen_commit, + r->secman_keyslot ? "bound" : "none", r->secman_prev ? "linked" : "genesis"); ck_printf("store: limit: anchor shares this disk, so a whole-disk rollback is not detectable " "(needs TPM NV or another external counter)\n"); } diff --git a/native/kernel/svc/store_boot.h b/native/kernel/svc/store_boot.h index e9ce0f3d..8843a2c1 100644 --- a/native/kernel/svc/store_boot.h +++ b/native/kernel/svc/store_boot.h @@ -34,9 +34,27 @@ * with PRODUCTION-class keys (owner hierarchy generation = active_key_epoch). * A wrong secret is refused by the AES-GCM-SIV tag before the Store is * touched. K_vol lives in a stack buffer for the unwrap only and is wiped. - * Limits (cut 1): TPM Slot 0 stays BLOCKED_HARDWARE, no key rotation - * (active_key_epoch 1), the manifest is not yet bound into the secman - * keyslot_manifest_id field. */ + * + * SECURITY MANIFEST (P04 cut 2a, ADR 0017 section 2.5). Every boot + * transaction also commits one SecurityManifest (kind 22, a sealed envelope + * whose root_mac is under k_root_auth): generation = the generation the + * transaction creates, security_sequence = previous + 1 (1 at genesis), + * previous_security_manifest_id = the ObjectId of the manifest it + * supersedes (zero at genesis), key_epoch = the owner hierarchy generation + * of the open keys, keyslot_manifest_id = the KeySlotManifest ObjectId (zero + * for a TEST-key Store, which has none), epoch = generation (the sealed + * Store's anti-rollback anchor counts Store generations). On every open the + * newest manifest is read back and must verify under the open keys, name + * this Store, bind exactly the keyslot the keyed open bound, carry the open + * keys' epoch, the generation that committed it and a security_sequence + * equal to the number of manifests on the Store. A Store with history but + * no manifest, or a manifest failing any check, is refused (CK_SB_E_SECMAN) + * before the boot record is written and the keys are wiped. + * Limits (cut 2a): TPM Slot 0 stays BLOCKED_HARDWARE, no key rotation + * (active_key_epoch 1); only the boot transaction writes a manifest + * (approve, continuity and journal commits do not advance + * security_sequence); agent_root_id, continuity_manifest_id and + * migration_manifest_id stay zero (not yet linked). */ #ifndef AIENOS_CK_STORE_BOOT_H #define AIENOS_CK_STORE_BOOT_H #include @@ -47,6 +65,7 @@ #define CK_BOOT_VERSION 1u #define CK_BOOT_COMMIT_MAX 64u #define CK_BOOT_RECORD_LEN 88u /* "AIENBOOT" u32 ver u32 0 u64 boot_count char commit[64] */ +#define CK_SECMAN_KIND 22u /* ADR 0017 section 2.5 SecurityManifest, M5_SECMAN_LEN bytes */ enum { CK_SB_COMMITTED = 0, CK_SB_REFUSED = 1 }; @@ -64,6 +83,9 @@ typedef struct { uint8_t identity_class; /* identity class of the keys given (M5_ID_*) */ int unlocked_genesis; /* ck_store_unlock_boot: this run created the keyslot manifest */ const char *key_source; /* ck_store_unlock_boot: "recovery-keyslot" */ + uint64_t secman_seq; /* security_sequence of the SecurityManifest this boot committed */ + int secman_keyslot; /* 1: it binds the KeySlotManifest ObjectId (production Store) */ + int secman_prev; /* 1: it links the manifest it supersedes (0 at genesis) */ } ck_store_report; #define CK_SB_E_TEST_KEYS (-2001) /* TEST identity keys refused (hardware staging) */ @@ -73,6 +95,7 @@ typedef struct { #define CK_SB_E_ENTROPY (-2005) /* genesis refused: kernel entropy service refused */ #define CK_SB_E_KEYSLOT_BAD (-2006) /* manifest decoded but has no usable recovery descriptor / wrong uuid */ #define CK_SB_E_CONTINUITY (-2007) /* service: continuity refused after the Store opened (lifecycle stays LOCKED) */ +#define CK_SB_E_SECMAN (-2008) /* SecurityManifest missing, malformed, unbound, stale or under other keys */ #define CK_SB_SECRET_LEN 32u /* TEST keys and store uuid. Public, not secret, never production. Not diff --git a/native/kernel/svc/tests/.crumb b/native/kernel/svc/tests/.crumb index 08eb60a6..1101afc8 100644 --- a/native/kernel/svc/tests/.crumb +++ b/native/kernel/svc/tests/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T07:42:03Z", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:88c4fc1ed3ed47dc767deb9c59923934ca9b73b66aabec84a2c3e19cebdf8283", + "digest": "sha256:c9cfdfae82f6668d32a1378c6ce99fbc5fd7b3a0f47cf3986ee0a8cf3ba40032", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 3, - "generated_at_commit": "453f41e7fca07a97ee52db3a125d106dfaf17ff5", - "source_tree": "sha256:73a6938e36e2d95d4f34a467b57ae383849f960dd994adc0c75d1a396140f6bb" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:3280a019c3894e8cd2621902dffef6cf605ba9c769131e815a8a13bdfa6b3820" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/svc/tests/stage_test.c b/native/kernel/svc/tests/stage_test.c index e201c2d2..fd0b8137 100644 --- a/native/kernel/svc/tests/stage_test.c +++ b/native/kernel/svc/tests/stage_test.c @@ -1192,6 +1192,95 @@ static void test_unlock_recovery(void) free(after); } +/* P04 cut 2a: the SecurityManifest (ADR 0017 section 2.5) every boot + * transaction commits: sequence 1 at genesis and previous + 1 on every later + * boot, the keyslot bound on a production Store and zero on a TEST-key one; + * a forged newer manifest under the right keys (wrong sequence, another key + * epoch, a keyslot the Store does not have) refuses the next boot and wipes + * the keys; the disk is left as found. */ +static void test_secman(void) +{ + ck_store_report r; + ss_keys k; + uint8_t S[32]; + for (int i = 0; i < 32; i++) S[i] = (uint8_t)(i * 3 + 5); + ck_store_test_keys(&k); + uint8_t *now = malloc(T_BYTES), *after = malloc(T_BYTES); + CHECK(now && after); + if (!now || !after) return; + + printf(" [secman: TEST-key Store: sequence 1 at genesis, then 2 and 3; no keyslot]\n"); + CHECK(dopen(1) == 0); + dclose(); + CHECK(boot(&k, "sm-1", &r) == 0 && r.secman_seq == 1 && r.secman_keyslot == 0 && r.secman_prev == 0 && r.gen_commit == 2); + CHECK(boot(&k, "sm-2", &r) == 0 && r.secman_seq == 2 && r.secman_keyslot == 0 && r.secman_prev == 1 && r.gen_commit == 3); + CHECK(boot(&k, "sm-3", &r) == 0 && r.secman_seq == 3 && r.secman_prev == 1 && r.gen_commit == 4); + + static const char *const forge_name[3] = {"sequence is not the manifest count", "another key epoch", + "a keyslot this Store does not have"}; + for (int v = 0; v < 3; v++) { + printf(" [secman: forged newer manifest under the right keys: %s -> refused, keys wiped, disk as found]\n", + forge_name[v]); + CHECK(dopen(1) == 0); + dclose(); + CHECK(boot(&k, "sm-f0", &r) == 0 && r.secman_seq == 1 && r.gen_commit == 2); + m5_secman f; + uint8_t buf[M5_SECMAN_LEN]; + memset(&f, 0, sizeof f); + memcpy(f.store_uuid, store_boot_store()->uuid, 16); + f.generation = 3; + f.epoch = 3; + f.security_sequence = 2; + f.key_epoch = 1; + if (v == 0) f.security_sequence = 7; + if (v == 1) f.key_epoch = 2; + if (v == 2) f.keyslot_manifest_id[0] = 1; + CHECK(m5_secman_seal(&f, store_boot_store()->keys.k_root_auth, buf) == 0); + ss_object o = {CK_SECMAN_KIND, 1, buf, sizeof buf}; + CHECK(dopen(0) == 0); + CHECK(ss_transact(store_boot_store(), &o, 1, 0, 0, 0) == 0); + dclose(); + CHECK(load(now) == 0); + int rc = boot(&k, "sm-f1", &r); + CHECK(rc == CK_SB_E_SECMAN && r.verdict == CK_SB_REFUSED && r.rc == CK_SB_E_SECMAN); + CHECK(r.proof && strcmp(r.proof, "keyed") == 0); + CHECK(nonzero((const uint8_t *)&store_boot_store()->keys, sizeof(ss_keys)) == 0); + CHECK(load(after) == 0 && memcmp(now, after, T_BYTES) == 0); + } + + printf(" [secman: a well-formed newer manifest (sequence 2, same keys, no keyslot) is accepted: sequence 3 next]\n"); + { + CHECK(dopen(1) == 0); + dclose(); + CHECK(boot(&k, "sm-g0", &r) == 0 && r.secman_seq == 1); + m5_secman f; + uint8_t buf[M5_SECMAN_LEN]; + memset(&f, 0, sizeof f); + memcpy(f.store_uuid, store_boot_store()->uuid, 16); + f.generation = 3; + f.epoch = 3; + f.security_sequence = 2; + f.key_epoch = 1; + CHECK(m5_secman_seal(&f, store_boot_store()->keys.k_root_auth, buf) == 0); + ss_object o = {CK_SECMAN_KIND, 1, buf, sizeof buf}; + CHECK(dopen(0) == 0); + CHECK(ss_transact(store_boot_store(), &o, 1, 0, 0, 0) == 0); + dclose(); + CHECK(boot(&k, "sm-g1", &r) == 0 && r.secman_seq == 3 && r.secman_prev == 1 && r.gen_commit == 4); + } + + printf(" [secman: production Store binds the KeySlotManifest ObjectId at genesis and on resume]\n"); + CHECK(dopen(1) == 0); + dclose(); + CHECK(unlock(S, 0, "sm-p1", 0, &r) == 0 && r.secman_seq == 1 && r.secman_keyslot == 1 && r.secman_prev == 0); + CHECK(unlock(S, 0, "sm-p2", 1, &r) == 0 && r.secman_seq == 2 && r.secman_keyslot == 1 && r.secman_prev == 1); + CHECK(unlock(S, 0, "sm-p3", 1, &r) == 0 && r.secman_seq == 3 && r.secman_keyslot == 1 && r.secman_prev == 1); + + unlink(img); + free(now); + free(after); +} + /* P05 cut 1: production continuity on the service lifecycle * (svc/continuity_service.c) over the real sealed Store in a file, opened the * production way (recovery keyslot unlock). Identity + ALLEN subject are @@ -2472,6 +2561,7 @@ int main(void) test_mmio_stage_report(); test_store(); test_unlock_recovery(); + test_secman(); test_continuity_service(); test_cortex_journal(); test_artifact_store(); diff --git a/scripts/.crumb b/scripts/.crumb index 16185149..6cb37738 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T08:47:00Z", + "compiled_at": "2026-10-12T09:21:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:f4c0b7b6f51641d9b7a64cc22dc53abd288f1ef112191df2fec9450529de4922", + "digest": "sha256:2e11a9899bf4b8d979c08da48c4ab1610e58b4fcd6d33c190a9f9980147c4a71", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 83, - "generated_at_commit": "638d78e94611546f909e559c035e640d06d2857f", - "source_tree": "sha256:4b5456a28ff42ec4d9fdf8b1526319f21f82bdbb7f608364ed4f6ed4d87d00e7" + "generated_at_commit": "b9baac8f34f2d2672c47de1ad892ad9bb16c174f", + "source_tree": "sha256:1e0e35389e09ebd623b2b785183347318fbfe3b704e9415d851cbcdf1c10d9bc" }, "owner_lane": "", "provenance": { diff --git a/scripts/qemu_ck_lifecycle_test.sh b/scripts/qemu_ck_lifecycle_test.sh index 992ee562..330dcdf1 100755 --- a/scripts/qemu_ck_lifecycle_test.sh +++ b/scripts/qemu_ck_lifecycle_test.sh @@ -91,6 +91,14 @@ # the disk (records=1, digest and chain re-verified at open); the fact # is never typed in that boot; the Store opens at generation 6 (journal open at 8: # note 4, journal header 5, fact 6, boot record 7, continuity resume 8) +# row 182 P04 cut 2a SecurityManifest, TEST-key Store (boot 2): the boot +# transaction commits `store: security manifest sequence=1 generation=2 +# keyslot=none previous=genesis` (no KeySlotManifest on a TEST Store) +# row 183 P04 cut 2a SecurityManifest, production Store: genesis (boot 3) +# `sequence=1 generation=2 keyslot=bound previous=genesis`; cold resume +# (boot 4) `sequence=2 generation=7 keyslot=bound previous=linked` (the +# manifest read back verified under K_root_auth, bound the keyslot the +# keyed open bound, carried key_epoch 1 and the manifest count) # build the default (diagnostic) image carries no lifecycle; CK_SERVICE is # refused with CK_CONSOLE_SESSION, CK_QEMU_UNSAFE_DMA and a CK_TEST_* # flag; CK_SERVICE_TEST_KEYS is refused with CK_HARDWARE_STAGING @@ -301,6 +309,7 @@ boot testkeys "${testkeys_efi}" drive_ready rcheck 163 "TEST-ONLY banner" '^lifecycle: TEST-ONLY service image \(CK_SERVICE_TEST_KEYS=1: TEST Store keys; QEMU only, never a production boot\)$' rcheck 163 "Store open, NVMe kept bound for the service lifetime" '^store: service lifetime: Store open, NVMe stays bound until the lifecycle stop order$' rcheck 163 "lifecycle ready" '^lifecycle: ready state=ready store=open \(operator input: serial\)$' +rcheck 182 "TEST-key Store: security manifest sequence 1 at genesis, no keyslot" '^store: security manifest sequence=1 generation=2 keyslot=none previous=genesis$' rcheck 173 "test-keys image provisions continuity at boot" '^continuity: PROVISIONED agent=[0-9a-f]{64} incarnation=1 sequence=1 cortex=0 branches=1$' before 173 "PROVISIONED < Store open line" '^continuity: PROVISIONED' '^store: service lifetime: Store open' if [[ -n "$(line_of '^dma_gate: nvme bus master revoked')" && "$(line_of '^dma_gate: nvme bus master revoked')" -lt "$(line_of '^lifecycle: ready state=ready')" ]]; then bad 163 "NVMe revoked before the lifecycle (service lifetime broken)"; else ok 163 "no NVMe revoke before the lifecycle"; fi @@ -335,6 +344,7 @@ rcheck 168 "short secret refused (64 hex digits expected)" '^store: unlock REFUS rcheck 168 "blank disk formatted as a production store" '^store: blank disk \(all-zero anchor \+ Store head\): formatted production store$' rcheck 168 "key source line: recovery keyslot genesis" '^store: key source=recovery-keyslot genesis=1 \(K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation\)$' rcheck 168 "store committed generation 2 boot 1" '^store: committed generation=2 boot_count=1$' +rcheck 183 "production genesis: security manifest sequence 1 binds the keyslot" '^store: security manifest sequence=1 generation=2 keyslot=bound previous=genesis$' rcheck 168 "unlock ok" '^store: unlock ok source=recovery-keyslot slot=1 genesis=1 generation=2 boot_count=1$' rcheck 168 "lifecycle unlocked to ready" '^lifecycle: unlock ok state=ready$' rcheck 168 "status open" '^lifecycle: state=ready store=open pending=- requests=' @@ -373,6 +383,8 @@ rabsent 169 "not reformatted" '^store: blank disk' rcheck 169 "key source line: recovery keyslot resume" '^store: key source=recovery-keyslot genesis=0 ' rcheck 169 "store opened at generation 6 (keyslot + boot record + continuity genesis + note + journal header + fact), boot_count 1" '^store: opened generation=6 boot_count=1 prev_commit=[0-9a-f]+ anchor=valid-resume$' rcheck 169 "store committed generation 7 boot 2" '^store: committed generation=7 boot_count=2$' +rcheck 183 "production resume: security manifest sequence 2 links the genesis one, keyslot bound" '^store: security manifest sequence=2 generation=7 keyslot=bound previous=linked$' +rabsent 183 "no SecurityManifest refusal in any boot" '^store: (unlock )?REFUSED proof=keyed step="SecurityManifest' rcheck 169 "unlock ok, no genesis" '^store: unlock ok source=recovery-keyslot slot=1 genesis=0 generation=7 boot_count=2$' rcheck 172 "ALLEN subject RESTORED sequence 1" '^allen: RESTORED subject=[0-9a-f]{64} sequence=1 lineage=[0-9a-f]{64} intents=0 active=0 knowledge=0$' rcheck 172 "identity RESUMED incarnation 2, same agent as the genesis boot" "^continuity: RESUMED agent=${unlock_agent} incarnation=2 sequence=2 cortex=0 branches=1\$" ```