interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / adr / 0014-binary-artifact-v0-and-native-admission.md

481 lines · 32144 bytes Raw Blame History Rendered
1# ADR 0014: Binary Artifact v0 and Native Admission
2
3Status: Proposed
4Date: 2026-09-25
5Phase 2 base: `04189416b0b14d8aa8961f2469caf52078fd2c09` (recovery closure, PR #117)
6Governing: [ADR 0012](0012-self-construction-capability-growth-and-generations.md), [ADR 0013](0013-aienos-abi-v1.md).
7Scope: SEED-0B qualification; no production owner root, M4 store, device authority, DMA, Secure Boot enrollment, TPM mutation, or self-promotion.
8
9AIENOS will accept a native task only from a canonical, signed Binary Artifact v0 whose identity covers its execution metadata, requested authority, resource envelope, and exact payload bytes. The kernel parses and verifies the same bytes that the loader later copies into private W^X EL0 pages; admission reduces each scoped request under local policy and emits a separately signed Admission Receipt v0. Serialized bytes, rather than Rust layout or firmware file-loading decisions, are the contract.
10
11## 1. Terms and trust boundary
12
13- **Binary Artifact**: one bounded byte string containing a fixed header, two section records, bounded capability requests, one resource envelope, exact code/data payload bytes, and a detached-in-identity signature block appended at EOF.
14- **ArtifactId**: the domain-separated SHA-256 identity of the canonical unsigned artifact bytes. It binds what may execute and what the artifact asks for.
15- **Capability request**: a bounded request for rights over one named kernel object or channel. It conveys no authority by itself.
16- **Granted admission**: the deterministic result of intersecting verified requests with local resource availability and local policy. A grant cannot contain rights or bounds broader than its corresponding request.
17- **Admission Receipt**: a canonical, signed record of verification, policy, exact requested and granted capability sets, resources, and execution/canary outcome.
18- **Qualification trust anchor**: an explicitly test-only Ed25519 identity. It may qualify SEED-0B but must never be confused with a production owner or machine identity.
19
20Firmware is a byte provider only. It may read a specifically named `.aien` file and reserve the pages holding it before firmware exit, then pass a read-only physical-address/length descriptor. It does not authenticate, interpret, or authorize the artifact. The kernel copies those bytes to protected staging memory before parsing; the staging pages are never executable.
21
22Host tooling provides `pack`, `inspect`, `id`, `sign`, and `verify`. `pack`
23is deterministic for the same canonical manifest and payload. Host and kernel
24verification use the same no-std parser and canonicalization implementation;
25the host must not sign a separate interpretation of the file.
26
27## 2. Binary Artifact v0 canonical encoding
28
29All offsets below are from the first artifact byte. All integers are unsigned fixed-width little-endian unless explicitly signed. Arrays are raw bytes. No serialized field is a Rust enum, pointer, `usize`, `bool`, or compiler-layout-dependent struct. There is no implicit padding. The decoder rejects nonzero reserved bytes, unknown flags, unknown section kinds, unknown rights, noncanonical ordering, duplicate resource requests, and unconsumed/trailing bytes. Rust structs are in-memory views only.
30
31### 2.1 Header: 128 bytes
32
33| Offset | Size | Field | v0 rule |
34|---:|---:|---|---|
35| 0 | 8 | magic | ASCII `AIENART\0` |
36| 8 | 2 | format_version | `0` |
37| 10 | 2 | header_size | `128` |
38| 12 | 2 | target_arch | `1` = AArch64 little-endian |
39| 14 | 2 | abi_version | `1` = AIENOS ABI v1 |
40| 16 | 4 | flags | `0` |
41| 20 | 4 | total_length | exact complete file length, including signature |
42| 24 | 4 | section_table_offset | `128` |
43| 28 | 2 | section_count | exactly `2` |
44| 30 | 2 | section_entry_size | `32` |
45| 32 | 2 | entry_section_index | `0` (code) |
46| 34 | 2 | reserved | zero |
47| 36 | 4 | entry_offset | byte offset within code section; 4-byte aligned |
48| 40 | 4 | capability_table_offset | `192` |
49| 44 | 2 | capability_count | `0..=16` |
50| 46 | 2 | capability_entry_size | `48` |
51| 48 | 4 | resource_envelope_offset | `capability_table_offset + count * 48` |
52| 52 | 2 | resource_envelope_size | `48` |
53| 54 | 2 | reserved | zero |
54| 56 | 4 | payload_offset | 16-byte alignment after the envelope; gap bytes are zero |
55| 60 | 4 | payload_length | exact sum of code and data file lengths |
56| 64 | 4 | signature_offset | exactly `payload_offset + payload_length` |
57| 68 | 2 | signature_length | `100` |
58| 70 | 2 | signature_algorithm | `1` = Ed25519 |
59| 72 | 56 | reserved | all zero |
60
61The section table follows the header immediately. Capability records follow
62the section table immediately. The 48-byte resource envelope follows the
63capability records immediately. Only the alignment gap between the envelope
64and payload is permitted, and it must be all zero. Payload bytes are code
65followed immediately by data. The 100-byte signature block follows the
66payload immediately and is the final byte range. Thus the total length is
67exactly `signature_offset + 100`.
68
69### 2.2 Section records: 32 bytes each
70
71| Offset | Size | Field | v0 rule |
72|---:|---:|---|---|
73| 0 | 2 | kind | `1` = code; `2` = data |
74| 2 | 2 | permissions | code exactly `R|X` (`5`); data exactly `R|W` (`3`) |
75| 4 | 4 | reserved | zero |
76| 8 | 4 | payload_relative_offset | relative to `payload_offset`; code `0`, data exactly code file length |
77| 12 | 4 | file_length | exact initialized bytes in the payload |
78| 16 | 4 | memory_length | mapped bytes before page rounding; code equals file length, data is at least file length |
79| 20 | 4 | alignment | `4096` |
80| 24 | 8 | reserved | zero |
81
82Records must occur in code-then-data order. Neither section may be empty.
83`alignment` constrains each section's virtual load base; it does not add
84padding between the serialized code and data payload bytes.
85The memory length must fit its envelope page allocation. The entry offset
86must identify a complete 4-byte AArch64 instruction inside code file bytes.
87There are no relocations, dynamic linking, writable-executable sections, or
88implicit imports in v0. Syscalls use ABI v1 and are checked against the
89task's admitted capability table.
90
91### 2.3 Capability requests: 48 bytes each
92
93| Offset | Size | Field | v0 rule |
94|---:|---:|---|---|
95| 0 | 2 | resource_kind | `3` = Object or `2` = Channel, matching ABI v1 `ResourceKind` |
96| 2 | 2 | flags | zero |
97| 4 | 4 | resource_id | concrete local resource number; zero is invalid |
98| 8 | 4 | rights | ABI v1 rights bits: READ=1, WRITE=2, MAP=4, GRANT=8, DERIVE=16, REVOKE=32 |
99| 12 | 4 | bounds_kind | `1` = object byte range; `2` = channel message/byte budget |
100| 16 | 4 | max_operations | positive hard upper bound |
101| 20 | 4 | reserved | zero |
102| 24 | 8 | max_bytes | positive byte limit for this resource |
103| 32 | 8 | byte_offset | object offset for kind 1; zero for kind 2 |
104| 40 | 8 | byte_length | nonzero object range for kind 1; zero for kind 2 |
105
106Rights must be nonzero and contain only the six defined ABI v1 bits. Object
107requests use bounds kind 1, with `max_bytes <= byte_length`; channel requests
108use bounds kind 2 and require zero offset/length. Both kinds require positive
109`max_operations` and `max_bytes`. A request must name exactly one resource
110and use exactly one valid bounds form. Records are strictly sorted by
111`(resource_kind, resource_id)` and duplicates are rejected. Policy may deny
112a request or reduce its rights, operation count, byte limit, and object
113range. The invariant is `granted capabilities ⊆ requested capabilities`;
114admission cannot mint a resource, add a right, extend a bound, or combine
115requests to create broader authority.
116
117### 2.4 Resource envelope: 48 bytes
118
119| Offset | Size | Field | v0 format maximum |
120|---:|---:|---|---:|
121| 0 | 4 | code_pages | 1..=64 |
122| 4 | 4 | data_pages | 1..=64 |
123| 8 | 4 | stack_pages | 1..=16 |
124| 12 | 2 | max_capabilities | `capability_count..=16` |
125| 14 | 2 | reserved | zero |
126| 16 | 4 | ipc_messages | 0..=1024 |
127| 20 | 4 | ipc_bytes | 0..=1,048,576 |
128| 24 | 8 | cpu_ticks | 1..=1,000,000,000 |
129| 32 | 8 | elapsed_ticks | 1..=1,000,000,000 |
130| 40 | 4 | syscall_count | 1..=65,536 |
131| 44 | 4 | reserved | zero |
132
133All page and byte arithmetic uses checked operations. The kernel may impose
134lower hard limits. It rejects an envelope before execution if a field
135exceeds either limit, section memory lengths do not fit the declared pages,
136the stack/IPC/capability resources cannot be reserved atomically, or any
137reservation would overflow. Partial task creation is forbidden: all required
138frames, page-table storage, stack, scheduler/task slot, and capability slots
139are reserved before pages are installed. Failure releases every reservation.
140
141### 2.5 Signature block: 100 bytes
142
143| Offset | Size | Field | Rule |
144|---:|---:|---|---|
145| 0 | 2 | algorithm | `1` = Ed25519 |
146| 2 | 2 | reserved | zero; header and block algorithm must match |
147| 4 | 32 | signer_fingerprint | SHA-256 of the raw 32-byte Ed25519 public key |
148| 36 | 64 | signature | Ed25519 signature over the domain-separated ArtifactId |
149
150The public key is obtained only from the selected local trust-anchor set by
151fingerprint. The artifact never supplies a key that can make itself trusted.
152Ed25519 means the RFC 8032 pure Ed25519 operation over the exact domain-plus-ID
153message shown below; Ed25519ph and Ed25519ctx are not interchangeable v0
154encodings. The kernel uses the pinned `no_std` RustCrypto `ed25519-dalek`
155verifier with strict signature validation. Its locked source dependency graph
156is vendored for offline builds; the implementation and feature review is
157recorded in [`ED25519_DEPENDENCY_REVIEW.md`](../ED25519_DEPENDENCY_REVIEW.md).
158Production trust-anchor sets are empty. Only a build explicitly marked
159`seed0b-test-anchor` may contain the public qualification key, and its boot
160report must identify the SEED-0B test qualification tier. The matching private
161test-vector seed is restricted to debug host qualification tooling and is not
162compiled into the kernel or ordinary release tooling.
163
164## 3. Canonical identity and signature
165
166For a well-formed artifact, `canonical_unsigned_artifact` is the exact byte
167range `[0, signature_offset)`: header, section records, capability records,
168resource envelope, required zero alignment bytes, and exact code/data bytes.
169The header's signature offset, length, and algorithm fields are included;
170the signer fingerprint and signature bytes are not.
171
172```text
173ArtifactId = SHA256(
174 "AIENOS-ARTIFACT-V1\0"
175 || canonical_unsigned_artifact
176)
177
178signature = Ed25519.Sign(
179 private_key,
180 "AIENOS-ARTIFACT-SIGNATURE-V1\0" || ArtifactId
181)
182```
183
184The file's payload digest is `SHA256(exact code bytes || exact data bytes)`.
185The loader separately hashes the bytes in its private loaded code/data pages
186after copy and deterministic zero-fill and before permissions become
187executable; that result must match the digest of the admitted image. Any
188change to code/data bytes, target, ABI, entry, requested rights/bounds, or
189resource envelope changes ArtifactId. Signature-block changes leave
190ArtifactId unchanged but must fail signer lookup or signature verification.
191
192## 4. Size, extension, and rejection rules
193
194- Maximum complete artifact length: 16 MiB. Maximum combined file payload:
195 8 MiB. Maximum section count: 2. Maximum capability count: 16.
196- Parsing uses checked integer arithmetic, validates every range against the
197 supplied byte slice, and rejects truncation, overflow, overlaps, gaps other
198 than the defined zero alignment bytes, payload spill, trailing bytes, and
199 lengths inconsistent with the exact complete file length.
200- Version 0 has no optional extension area. Unknown flags, reserved values,
201 enum values, target/ABI values, section kinds, bounds kinds, rights bits,
202 and signature algorithms are rejected. A later incompatible encoding
203 requires a new format version and an explicit decoder; v0 readers never
204 skip unknown data.
205- Entry point outside code file bytes, unaligned entry point, empty sections,
206 memory lengths exceeding page budgets, invalid rights/bounds, duplicate or
207 unsorted resources, or any nonzero reserved byte are structural failures.
208- Stable kernel rejection reasons include `BadMagic`, `UnsupportedVersion`,
209 `WrongTarget`, `WrongAbi`, `LengthOverflow`, `Truncated`, `SectionOverlap`,
210 `BadEntryPoint`, `DigestMismatch`, `UntrustedSigner`, `BadSignature`,
211 `MalformedCapability`, `RightsEscalation`, and `ResourceLimit`.
212
213## 5. Admission, loading, and lifecycle
214
215Admission is deterministic and does not execute candidate code. Its input is
216the parsed and structurally validated metadata, successful ArtifactId and
217signature verification, local trust anchors, local policy, and a snapshot of
218reservable kernel resources. It checks target, ABI, signer trust, request
219resolution, rights/bounds intersection, entry point, the full resource
220envelope, and policy digest. A request denied by policy receives no handle;
221if the task's required contract cannot be met, admission rejects the whole
222candidate.
223
224For a deterministic `policy_digest`, the v0 canonical local policy starts
225with a 64-byte header, then zero or more 48-byte resource-policy records sorted
226by `(resource_kind, resource_id)`, then zero or more sorted 32-byte trusted
227signer fingerprints. The header is: magic `AIENPOL\0` (8 bytes), version
228u16=`0`, header size u16=`64`, resource-record size u16=`48`, resource-record
229count u16=`0..=16`, maximum code/data/stack pages u32 each, maximum capability
230count u32, maximum IPC messages u32, maximum IPC bytes u32, maximum CPU ticks
231u64, maximum elapsed ticks u64, maximum syscalls u32, trusted-signer count u16
232`0..=8`, and reserved u16 zero. Each resource record uses the same 48-byte
233field encoding as a capability request, but `rights`, `max_operations`,
234`max_bytes`, and object range fields describe the greatest grant policy allows
235for that resource. Signer fingerprints are SHA-256 fingerprints of locally
236trusted artifact public keys; the artifact itself never supplies a trust key.
237The digest is `SHA256("AIENOS-ADMISSION-POLICY-V1\0" || exact_policy_bytes)`.
238A kernel may apply stricter compiled-in hard maxima; these are part of its
239verifier/build identity and cannot be relaxed by artifact metadata.
240
241The loader pipeline is fixed: receive bytes; parse; validate structure;
242compute ArtifactId; verify signature; run admission policy; reserve every
243resource atomically; allocate private code/data/stack pages; copy exact file
244bytes and zero-fill the declared memory tails; hash the `file_length` bytes
245read back from the private code pages followed by the `file_length` bytes
246read back from the private data pages (excluding page padding and zero-fill
247tails); compare with the admitted payload digest; clean D-cache, invalidate I-cache,
248and issue required AArch64 barriers; remove code write permission; map code
249EL0 RX, data EL0 RW+NX, and stack EL0 RW+NX (with guard pages where the page
250map permits); install only the granted M3 capability handles; then make the
251task runnable in EL0. No writable alias to executable physical pages is
252allowed. The source/staging buffer remains NX and is not mapped into the task.
253
254Every candidate follows `Received → Parsed → Verified → Authorized → Mapped
255→ CanaryRunning → CanaryPassed → Admitted`. Every failure enters
256`Rejected/Destroyed`, revokes candidate capabilities, releases pages and
257slots, and records evidence. Timeout, fault, invalid syscall, resource
258overrun, or failed canary terminates only the candidate. Scheduler code has
259no artifact parser or signature responsibilities.
260
261## 6. Trust-anchor and signing interfaces
262
263The shared no-std artifact library exposes separable interfaces equivalent
264to `TrustAnchorSet`, `SignatureVerifier`, `ArtifactVerifier`, and
265`ReceiptSigner`. Ed25519 is the v0 signature algorithm; use a reviewed no-std
266implementation with pinned, offline-available sources. Do not implement
267elliptic-curve cryptography locally.
268
269The ordinary production trust-anchor set is empty and fails closed. A build
270feature named `seed0b-test-anchor` may add one known qualification public key;
271the boot report must visibly identify a SEED-0B qualification build. The
272matching private test key is explicitly TEST ONLY and exists only in the
273qualification signer/test fixture; it is never embedded in a kernel image,
274boot media, or ordinary/release tooling defaults. It cannot enroll Secure
275Boot keys or alter TPM state. No owner root or production receipt key is
276created in Phase 2; those ceremonies belong to M5.
277
278## 7. Admission Receipt v0
279
280Receipt encoding is also independent of Rust layout. Every multi-byte value
281is little-endian, reserved bytes are zero, and the record has exactly 512
282bytes. Unknown versions, flags, decisions, tiers, algorithms, inconsistent
283presence flags, and nonzero absent optional fields are rejected.
284
285### 7.1 Fixed record layout
286
287| Offset | Size | Field | Rule |
288|---:|---:|---|---|
289| 0 | 8 | magic | ASCII `AIENRCP\\0` |
290| 8 | 2 | receipt_version | `0` |
291| 10 | 2 | header_size | `96` |
292| 12 | 4 | record_size | `512` |
293| 16 | 4 | flags | bit 0 machine ID present; bit 1 context ID present; bit 2 timestamp present; all others zero |
294| 20 | 2 | decision | `1` admitted; `2` rejected; `3` canary failed; `4` destroyed |
295| 22 | 2 | qualification_tier | `1` = SEED-0B QEMU test qualification; `2` = SEED-0B Machine 1 test qualification; `0` and all others rejected (no production tier in v0) |
296| 24 | 8 | sequence | monotonically increasing sequence within one verifier context |
297| 32 | 16 | nonce | unique within that verifier context |
298| 48 | 8 | observed_time_ns | UTC observation metadata, or zero when flag 2 is clear; never an admission input |
299| 56 | 8 | reserved | zero |
300| 64 | 4 | execution_status | `0` not run; `1` exited; `2` timeout; `3` fault; `4` bad syscall; `5` resource overrun; `6` canary failed |
301| 68 | 4 | exit_status | signed 32-bit little-endian task exit code; zero if not executed |
302| 72 | 4 | result_flags | bit 0 authorized read succeeded; bit 1 write denied; bit 2 candidate reclaimed; bit 3 canary passed; bit 4 forged handle denied; bit 5 mapped bytes matched admitted digest; bit 6 executed bytes matched mapped bytes; bit 7 W^X seal audit passed; all others zero |
303| 76 | 2 | rejection_stage | `0` when admitted; otherwise the §7.3 stage code at which the candidate was refused |
304| 78 | 2 | rejection_reason | `0` when admitted; otherwise the §7.3 stable reason code |
305| 80 | 4 | syscalls | EL0 syscalls taken; zero if not executed |
306| 84 | 4 | object_reads_ok | authorized object reads that succeeded |
307| 88 | 4 | denials | syscalls answered with a denial |
308| 92 | 4 | frames_reserved | task frames reserved (content, window tables, shadow tables); zero if refused before reservation |
309| 96 | 32 | artifact_id | ArtifactId |
310| 128 | 32 | payload_digest | SHA-256 of exact serialized code/data payload |
311| 160 | 32 | artifact_signer_fingerprint | fingerprint from verified artifact signature block |
312| 192 | 32 | policy_digest | digest of canonical local policy used for this decision |
313| 224 | 32 | requested_capability_digest | digest of canonical request records |
314| 256 | 32 | granted_capability_digest | digest of canonical grants; zero if rejected before grants |
315| 288 | 32 | resource_envelope_digest | digest of the canonical 48-byte envelope |
316| 320 | 32 | verifier_identity | stable verifier/build identity digest |
317| 352 | 32 | machine_id_digest | SHA-256 identity digest, or all zero when absent |
318| 384 | 16 | generation_context_id | generation u64 then context ID u64; both zero when absent |
319| 400 | 2 | receipt_signature_algorithm | `1` = Ed25519 |
320| 402 | 2 | reserved | zero |
321| 404 | 32 | receipt_signer_fingerprint | SHA-256 of raw Ed25519 receipt public key |
322| 436 | 64 | receipt_signature | signature over domain-separated receipt digest |
323| 500 | 12 | reserved | zero |
324
325All digests are SHA-256 outputs in their ordinary 32-byte order. Compute:
326
327```text
328requested_capability_digest = SHA256(
329 "AIENOS-ARTIFACT-CAP-REQUESTS-V1\0" || exact_sorted_request_records
330)
331granted_capability_digest = SHA256(
332 "AIENOS-ADMISSION-CAP-GRANTS-V1\0" || exact_sorted_grant_records
333)
334resource_envelope_digest = SHA256(
335 "AIENOS-ARTIFACT-RESOURCES-V1\0" || exact_48_byte_resource_envelope
336)
337verifier_identity = SHA256(
338 "AIENOS-VERIFIER-IDENTITY-V1\0" || verifier_build_identity_bytes
339)
340machine_id_digest = SHA256(
341 "AIENOS-MACHINE-ID-V1\0" || canonical_provisioned_MachineId_bytes
342)
343```
344
345These use canonical byte encodings, never Rust memory. The verifier build
346identity bytes are the lowercase 40-byte Git commit ID, target and ABI as
347u16 little-endian values, and a one-byte qualification feature ID (zero for
348ordinary builds; one for `seed0b-test-anchor`).
349The machine ID slot contains this digest of the opaque provisioned MachineId,
350not hardware make/model data. If M5 has not provisioned a MachineId, the
351field is all zero and the presence flag is clear.
352
353Consistency rules (decoder-enforced): an admitted receipt has zero
354`rejection_stage` and `rejection_reason`. A rejected receipt has both
355nonzero, `execution_status` 0, `exit_status` 0, zero counters, and no
356result flag other than bit 2. Canary passed (bit 3) requires
357`execution_status` 1 and `exit_status` 0. Fields that the failing stage had
358not yet computed are all zero (for example `granted_capability_digest`
359before Authorized; every identity field when parsing failed).
360
361### 7.3 Stage, reason and outcome codes
362
363Stage codes: `1` received, `2` staged, `3` verified, `4` authorized,
364`5` reserved, `6` mapped, `7` hashed, `8` sealed, `9` capabilities
365installed.
366
367Reason codes `1..=19` are the `ArtifactError` values of §4 in declaration
368order (`BadMagic` = 1 … `RightsEscalation` = 19); `MalformedReceipt` (20)
369is a receipt-decoding error and never a candidate reason. Loader reasons:
370`0x101` no frames, `0x102` staging too large, `0x103` mapping, `0x104`
371mapped digest mismatch, `0x105` W^X audit, `0x106` capability install,
372`0x107` scheduler full, `0x108` executed digest mismatch, `0x109` reclaim,
373`0x10a` firmware read. Any other value is rejected.
374
375`execution_status` maps the task runtime outcome: not run `0`, exited `1`,
376timeout `2`, fault `3`, bad syscall `4`, resource overrun `5`. `exit_status`
377is the low 32 bits of the EL0 exit code read as a two's-complement `i32`.
378
379Sequence and nonce in a qualification boot: `sequence` counts candidates
380from 1 within one boot (the verifier context; there is no persistent
381counter before M4) and `flags` bit 1 stays clear.
382`nonce = SHA256("AIENOS-ADMISSION-RECEIPT-NONCE-V1\0" || verifier_identity || sequence_u64_le)[0..16]`,
383which is unique within the context and reproducible from the receipt.
384
385Signing custody in SEED-0B: the kernel never holds a receipt private key.
386It emits the canonical record with the signature block (bytes 400..512)
387all zero plus the ReceiptDigest. The host qualification harness re-derives
388the digest from the emitted bytes, checks every bound field against the
389artifact it supplied, and signs the record with the TEST-ONLY SEED-0B
390receipt key (RFC 8032 TEST 2, distinct from the artifact test key), then
391verifies the signed record. Production receipt keys wait for M5.
392
393### 7.2 Receipt digest and signature
394
395The receipt signature block is excluded from its own digest. The digest
396input is the exact canonical bytes `[0, 400)`; signature algorithm and
397signer fingerprint are metadata in the signature block, outside that
398range.
399
400```text
401ReceiptDigest = SHA256(
402 "AIENOS-ADMISSION-RECEIPT-V1\0" || receipt_bytes[0..400]
403)
404
405receipt_signature = Ed25519.Sign(
406 receipt_private_key,
407 "AIENOS-ADMISSION-RECEIPT-SIGNATURE-V1\0" || ReceiptDigest
408)
409```
410
411The test receipt key has a distinct qualification fingerprint. Production
412receipt-key custody waits for M5. Wall-clock timestamps are observation
413metadata only; authorization depends on deterministic policy, verified
414bytes/signatures, and reserved resources. Sequence numbers increase within
415the verifier context; nonce bytes are unique within that context. Qualification
416receipts label the context scope so their sequence is not mistaken for a
417machine-persistent counter before M4.
418
419## 8. SEED-0B qualification boundary
420
421The first artifact is a small AArch64 EL0 program requesting READ on one
422existing object and no WRITE, device, DMA, network, filesystem, NVMe-write,
423or firmware authority. It must read through the admitted handle, receive a
424denial on write through that handle, and exit deterministically. QEMU
425qualification must precede any Machine 1 boot, using identical artifact bytes
426and ArtifactId. Physical qualification uses the one-time boot discipline and
427must preserve Secure Boot, TPM state, BootOrder, and the existing Linux
428recovery path. An artifact or AI agent cannot authorize or promote itself.
429
430The acceptance invariant is:
431
432```text
433identified bytes = verified bytes = admitted bytes = mapped bytes = executed bytes
434```
435
436Qualification harness: `scripts/qemu_artifact_test.sh` (run by
437`verify_all.sh`) boots the TEST ONLY qualification image with the SEED-0B
438artifact (`P26SEED`), the P2-5 probes and the H01–H29 negative matrix from
439`aienos-artifact-tool negative-corpus`, then an ordinary build that must
440refuse everything. Every candidate's unsigned receipt is checked against the
441supplied artifact, signed with the TEST ONLY receipt key and verified. Each
442canonical marker (`ARTIFACT_*`, `SEED0B_*`, `ADMISSION_RECEIPT`,
443`HOSTILE_MATRIX`) passes only if every check tagged with it passed;
444`SEED_0B_QEMU` requires all of them. The same script verifies a captured
445Machine 1 console log against byte-identical staged inputs
446([SEED0B_MACHINE1_QUALIFICATION.md](../SEED0B_MACHINE1_QUALIFICATION.md)),
447yielding `SEED_0B_MACHINE1`.
448
449Phase 2 is complete only after the same qualified artifact is admitted,
450executed with attenuated authority, denied an unauthorized write, reclaimed,
451and covered by a valid receipt in QEMU and then on Machine 1.
452
453## Amendment note, 2026-10-08: second TEST key for OSC unit containers
454
455This note adds to section 6 and does not change the status of this ADR or any other text in it.
456
457Section 6 allows a `seed0b-test-anchor` build to add "one known qualification public key". Today that key is the RFC 8032 TEST 1 public key (`d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a`, signer fingerprint `21fe31dfa154a261626bf854046fd2271b7bed4b6abe45aa58877ef47f9721b9`). It verifies Binary Artifact v0.
458
459The OSC unit container ([aien-protocols](https://github.com/aien-spark/aien-protocols) `specs/osc-unit-artifact`, PR #17, v1 draft) is a different format with its own conformance vectors. Those vectors are signed with a different throwaway key, `keys/test1.pub` of that spec, whose signer fingerprint is `7b136f1c9197f8a99a91057f5deced18d5754669e559ee7cc4f7cef64a626abf`. It is not the RFC 8032 TEST 1 key.
460
461Amendment: a `seed0b-test-anchor` qualification build may also hold the OSC unit spec's TEST key (`specs/osc-unit-artifact/keys/test1.pub`, fingerprint `7b136f1c9197f8a99a91057f5deced18d5754669e559ee7cc4f7cef64a626abf`), beside the RFC 8032 TEST 1 key. The OSC unit admission path trusts only the spec key and Binary Artifact v0 admission trusts only the RFC 8032 key; neither key is accepted on the other path.
462
463- This is TEST only. The private seed of the spec key is derivable from a public label in the spec's generator and is not secret.
464- A release image holds neither key, and its trust-anchor sets stay empty.
465- The qualification gate checks this: the OSC unit gate refuses a TEST-signed unit in an ordinary build, and the boot report names the build as a TEST-only qualification tier.
466
467Observation, no change made here: the `execution_status` mapping text in section 7.1 lists codes 0 to 5, while the field table above it also lists `6` (canary failed). The mapping text omits 6.
468
469## Amendment, 2026-10-08: the OSC unit is a second container type
470
471This amendment does not change the status of this ADR, the Binary Artifact v0 encoding, its limits, its rejection reasons, its receipt, or its trust anchor. It records how the OSC unit container ([aien-protocols](https://github.com/aien-spark/aien-protocols) `specs/osc-unit-artifact`, PR #17, container version 1) relates to this ADR. It settles conflicts C2 and C3 of that spec's section 15.3 and records the AIENOS position on C1.
472
473Decision record: the operator was offered three choices on aienos#277 (record the OSC unit as its own container type; fit it into Binary Artifact v0; or keep it as an unrecorded QEMU-only path) and on 2026-10-08 delegated the choice ("proceed with however you think best"). The orchestrator chose the first, which this amendment writes down.
474
4751. **Two container types.** AIENOS recognizes two native container types, told apart by their first eight bytes: Binary Artifact v0 (this ADR, sections 2 to 7) and the OSC unit (magic `OSCUNIT\0`, defined only by the aien-protocols spec). Neither format is a version or extension of the other. The native loader routes on that magic: bytes beginning `OSCUNIT\0` go to the OSC unit path and never reach the Binary Artifact v0 parser, and everything else goes to the Binary Artifact v0 path. Each parser also refuses the other format on its own (`BadMagic` in Binary Artifact v0, `BAD_MAGIC` in the OSC unit reader), so a routing mistake is refused, never misread.
4762. **Separate parsers and admission paths.** Each container has its own parser and admission path. Neither path calls the other's parser, and section 5 of this ADR still has no OSC unit responsibilities. Bytes reach both paths the same way (section 1: firmware or the Store is a byte provider only; the kernel copies to protected staging before parsing).
4773. **Limits (spec conflict C3).** The limits of section 4 ("Maximum section count: 2", 16 MiB per artifact, 8 MiB payload, 16 capabilities) apply to Binary Artifact v0 only. An OSC unit is held to the limits of its own spec (section 7 there: 4 sections, 2 MiB, 16 capabilities), plus any stricter limit compiled into the kernel, which is part of the kernel's identity and cannot be relaxed by the unit. Today that is the native staging limit of 160 pages (655,360 bytes) per artifact.
4784. **Trust anchors (spec conflict C2).** Unchanged from the amendment note above: each path trusts only its own anchors, a qualification build may hold the spec's TEST key for the OSC unit path, and a release image holds no test key for either path. OSC unit OWNER anchors stay empty until TRUST-1 (ADR 0017) provisions them.
4795. **Pinned generations (spec conflict C1, AIENOS position).** No AIENOS ADR yet defines a per-resource generation that an OSC unit capability request could pin. Until one does, the OSC unit admission path refuses every request that pins a nonzero `required_generation`, because the kernel has no generation to compare it with. The refusal code follows the spec's fixed check order (its section 8.2): a request on an unsupported domain is refused `CAP_DOMAIN_UNSUPPORTED` (27) first, a domain-1 value wider than 32 bits `CAP_GEN_NOT_REPRESENTABLE` (28) next, and any remaining nonzero pin `CAP_GENERATION_STALE` (29). AIENOS supports domain 1 only. That direction only ever refuses more, never admits more. Defining a per-resource generation is a later AIENOS amendment; it needs no byte change in the container. Update 2026-10-08: [ADR 0019](0019-per-resource-capability-generation.md) (Option 3, accepted) defines it as a per-resource incarnation counter, to be built in the first change that lets a resource number be reused or persisted (aienos#285); until then this refusal stands unchanged.
4806. **Admitted is not Admitted.** Section 5 of this ADR reaches `Admitted` only after a canary run. The OSC unit path defines no canary, so an accepted OSC unit is reported as accepted by its own path, never as `Admitted` in the sense of section 5, and no Admission Receipt v0 (section 7) is issued for it. A canary and a receipt for OSC units are later work.
4817. **Evidence boundary.** The OSC unit path in aienos#277 is qualified in QEMU only. A QEMU pass is not a result on the physical Spark.