aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / docs / native / PI5-4-UNLOCK-RUNS.md
| 1 | # PI5-4 unlock runs on the Raspberry Pi 5 (qualification evidence) |
| 2 | |
| 3 | Tier: PI5-UNLOCK-QUALIFICATION. Image: `make pi5-unlock-card` at commit 55f6cc0130d2932263ef0baece5a89c88a99c739 |
| 4 | (BOOTAA64.EFI sha256 8936579f86eb367fb14fef725bc363e647d2ee46b914a7b57397fa3741f3e10a). The recovery secret is a |
| 5 | THROWAWAY (32 random bytes from /dev/urandom, never committed, never printed); the request file |
| 6 | \EFI\AIENOS\UNLOCK.REQ was placed on the card by `pi5-run.sh UNLOCK_REQ=...` and zeroed, deleted and checked |
| 7 | absent after each run (`unlock_req_deleted_verified`). Not a production Store: no TPM (Slot 0), the secret came |
| 8 | from the card. Logs: `~/workspace/pi5-runs/<tag>/kernel.log` on the Spark (not committed). |
| 9 | |
| 10 | Before run A the AIENOS partition (/dev/mmcblk0p2 on the hub, 8388608 sectors, not mounted) held a TEST-tier Store. |
| 11 | Its first 48 sectors were zeroed and read back as zeros (`head_zeroed_readback_ok`), so the new Store is |
| 12 | production-class from its first byte and never reuses TEST content. |
| 13 | |
| 14 | ## Run A, pi5-unlock-a: first-time setup with secret S |
| 15 | |
| 16 | ``` |
| 17 | unlock_req: found a well-formed request file (QUALIFICATION ONLY, throwaway secret); secret not printed |
| 18 | unlock_source: card request file (QUALIFICATION ONLY, throwaway secret) |
| 19 | store: identity class=1 (production); anchor lba=0 store lba=32 units=1048563 |
| 20 | store: blank disk (all-zero anchor + Store head): formatted production store |
| 21 | store: key source=recovery-keyslot genesis=1 (K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation) |
| 22 | store: opened generation=1 boot_count=0 prev_commit=none anchor=valid-resume |
| 23 | store: committed generation=2 boot_count=1 |
| 24 | store: security manifest sequence=1 generation=2 keyslot=bound previous=genesis |
| 25 | store: limit: anchor shares this disk, so a whole-disk rollback is not detectable (needs TPM NV or another external counter) |
| 26 | stage store: ok |
| 27 | ``` |
| 28 | |
| 29 | Result: blank Store formatted as a PRODUCTION-class Store, KeySlotManifest bound, generation 1 to 2, boot_count 1. |
| 30 | |
| 31 | ## Run B, pi5-unlock-b: reboot, same secret S |
| 32 | |
| 33 | ``` |
| 34 | unlock_req: found a well-formed request file (QUALIFICATION ONLY, throwaway secret); secret not printed |
| 35 | unlock_source: card request file (QUALIFICATION ONLY, throwaway secret) |
| 36 | store: identity class=1 (production); anchor lba=0 store lba=32 units=1048563 |
| 37 | store: key source=recovery-keyslot genesis=0 (K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation) |
| 38 | store: opened generation=2 boot_count=1 prev_commit=55f6cc0130d2932263ef0baece5a89c88a99c739 anchor=valid-resume |
| 39 | store: committed generation=3 boot_count=2 |
| 40 | store: security manifest sequence=2 generation=3 keyslot=bound previous=linked |
| 41 | store: limit: anchor shares this disk, so a whole-disk rollback is not detectable (needs TPM NV or another external counter) |
| 42 | stage store: ok |
| 43 | ``` |
| 44 | |
| 45 | Result: the Store reopens through the Slot 1 recovery path, no reformat, generation 2 to 3, boot_count 2, the |
| 46 | SecurityManifest sequence advances to 2 and links the first. |
| 47 | |
| 48 | ## How "nothing written" was checked (cut 4) |
| 49 | |
| 50 | After each refused run, the hub (Linux, partition not mounted) read the Store view of the AIENOS partition (sectors |
| 51 | 0 to 8388543, so the 64-sector run marker at the end is excluded because it changes every run) and took its SHA-256. |
| 52 | |
| 53 | - H0, taken after Run B and before Run C: 7954edfc924ac4c20d3599757149b81b9497a110757f6ea83ef30bc4b94a9943 |
| 54 | - H1, taken after Run C: 7954edfc924ac4c20d3599757149b81b9497a110757f6ea83ef30bc4b94a9943 (equal to H0) |
| 55 | |
| 56 | ## Run C, pi5-unlock-c: wrong secret W (last byte differs from S) |
| 57 | |
| 58 | ``` |
| 59 | unlock_req: found a well-formed request file (QUALIFICATION ONLY, throwaway secret); secret not printed |
| 60 | unlock_source: card request file (QUALIFICATION ONLY, throwaway secret) |
| 61 | store: identity class=1 (production); anchor lba=0 store lba=32 units=1048563 |
| 62 | store: key source=recovery-keyslot genesis=0 (K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation) |
| 63 | store: REFUSED proof=keyed step="recovery secret rejected (K_vol unwrap tag failed); disk not opened" rc=-2004 (RecoverySecretRejected); disk left as found, not reformatted |
| 64 | stage store: FAIL rc=-2004 |
| 65 | ``` |
| 66 | |
| 67 | Result: refused, and the Store view hash after the run equals the hash before (H0 = H1), so nothing was written. |
| 68 | |
| 69 | ## Run D, pi5-unlock-d: one byte of the KeySlotManifest flipped, correct secret S |
| 70 | |
| 71 | The locator (`ck_pi5_store_locate`, run on a copy of the partition) put the KeySlotManifest at Store unit 6, partition |
| 72 | sector 80, byte offset 40960, 640 bytes. The wrapped K_vol of the recovery slot is at byte offset 41272. One byte there |
| 73 | was XOR-ed with 0xFF (0x8b to 0x74) on the card by a whole-sector read-modify-write, read back, and checked to differ |
| 74 | from the original in exactly one byte. |
| 75 | |
| 76 | ``` |
| 77 | unlock_source: card request file (QUALIFICATION ONLY, throwaway secret) |
| 78 | store: identity class=1 (production); anchor lba=0 store lba=32 units=1048563 |
| 79 | store: key source=recovery-keyslot genesis=0 (K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation) |
| 80 | store: REFUSED proof=keyed step="no KeySlotManifest on a non-blank disk" rc=-105 (MountError::CorruptRecoveryRequired); disk left as found, not reformatted |
| 81 | stage store: FAIL rc=-105 |
| 82 | ``` |
| 83 | |
| 84 | Result: refused with CorruptRecoveryRequired, no reformat. After the run, a byte-for-byte comparison of the Store view |
| 85 | against the pre-flip copy showed exactly one differing byte, the flipped one (hash after Run D 37d47b09...a85791), so the |
| 86 | refusal wrote nothing. Limit: the refusal comes from the object integrity check on the manifest, which treats the damaged |
| 87 | manifest as absent on a non-blank disk; it is not a separate "slot tag mismatch" message. The SecurityManifest (sealed |
| 88 | envelopes) was not targeted because it cannot be located without the keys. |
| 89 | |
| 90 | ## Run E, pi5-unlock-e: byte restored, correct secret S |
| 91 | |
| 92 | The original byte was written back (the saved sector was byte-identical on readback) and the Store view hash returned to |
| 93 | H0 (7954edfc...a9943) before the run. |
| 94 | |
| 95 | ``` |
| 96 | unlock_source: card request file (QUALIFICATION ONLY, throwaway secret) |
| 97 | store: identity class=1 (production); anchor lba=0 store lba=32 units=1048563 |
| 98 | store: key source=recovery-keyslot genesis=0 (K_vol source: the Slot 1 recovery descriptor; TPM Slot 0 BLOCKED_HARDWARE; no rotation) |
| 99 | store: opened generation=3 boot_count=2 prev_commit=55f6cc0130d2932263ef0baece5a89c88a99c739 anchor=valid-resume |
| 100 | store: committed generation=4 boot_count=3 |
| 101 | store: security manifest sequence=3 generation=4 keyslot=bound previous=linked |
| 102 | stage store: ok |
| 103 | ``` |
| 104 | |
| 105 | Result: the Store reopens after the damage is repaired, generation 3 to 4, boot_count 3, SecurityManifest sequence 3 linked |
| 106 | to the previous one. In every run the request file was deleted from the card and verified absent afterwards. |