Commit dfcd8f4
kernel: ADR-018 step 7 — boot integration: init runs as PID 1 (coexistence, x86_64)
The coexistence milestone (ADR-018 § 6): the kernel boot path now
verifies + transcribes the manifest, creates init as PID 1, maps the
manifest blob into it, and init parses + validates in userspace and
idles — while the legacy BOOT_MODULE_ORDER chain still starts every
service, byte-for-byte. Full machinery exercised, zero behavior
change. Boot proof (x86_64, 3 consecutive runs, 8.9s):
✓ Boot manifest transcribed: 15 spawn row(s), 1 reserved endpoint(s)
✓ Registered init (created after manifest transcription)
✓ init created as PID 1: task 16 process 18 (endpoint 1, manifest at 0x1000000)
[init] CambiOS init starting
[init] manifest valid: 15 service(s) described; supervision starts at the step-8 cutover
Init's register_endpoint(1) is the step-3 reservation gate's first
live customer — admitted because the kernel bound init's
manifest-declared AID at creation and the transcribed reservation
names the same AID.
Kernel (src/microkernel/main.rs): the module loop gains an init arm
(register spawn-only, never auto-started, never boot-gated — neither
the manifest nor init consumes the module-0-boots-Ready slot); after
the loop, create_init_process runs iff a manifest was transcribed.
It loads init's signed ELF, maps the manifest module's pages
read-only at MANIFEST_USER_VADDR (module physical memory, shared
with the boot-module registry, deliberately NOT VMA-tracked —
destroy_process reclaims VMA-tracked regions and these pages are not
init's to free; the fixed address sits below VMA_ALLOC_BASE per the
ELF-segment convention; Limine module addresses are HHDM-virtual, so
the mapping converts via hhdm_offset), installs the narrow ADR-018
§ 4 capability set (receive on init's endpoint + CreateProcess —
nothing else), binds the manifest-declared AID, and calls
set_init_process — arming the step-5 handle_spawn manifest branch.
Runs while the boot path still exclusively borrows the BSP
scheduler, so all setup lands before init's first instruction.
Manifest-without-init is a broken image ⇒ typed InitModuleMissing;
init-without-manifest degrades to legacy boot. BootError gains
InitModuleMissing + InitCreationFailed; the error.rs test variant
lists (drifted since the step-4 additions) are caught up and now
exhaustive.
First-boot bug caught and fixed in-session: create_init_process
originally mapped init's OWN ELF bytes at MANIFEST_USER_VADDR (the
manifest module's bytes were transcribed in-loop but never stashed),
so init read an ELF header where CBOSMANI belonged and refused. The
function now takes (init_elf, manifest_blob) as two named buffer
pairs — the conflation is unrepresentable at the signature. The
failure mode itself validated the coexistence design: init exited 1,
the legacy chain was untouched, boot completed.
Coexistence scaffolding (both retire at the step-8 cutover, per the
ADR's staged plan):
- tools/build-manifest --init-only-reservations + `make
manifest-step7`: emits entries with reservations suppressed (only
init's endpoint 1 lands in the reservation table — old-chain
services are bootstrap-bound and must still register their own
endpoints). Grants, dependencies, and lifetimes emit at full
fidelity; the spawn table is dormant until init spawns.
- user/init `supervise` cargo feature (default OFF): the spawn wave
is compiled out — running it now would double-spawn everything the
legacy chain starts. Engine construction (DAG + permutation
validation) still runs, so step 7 exercises the full parse path.
Boot image (x86_64): `make iso` stages signed init.elf +
manifest.bin (signed once by manifest-step7 — NOT re-signed in the
ISO recipe; stacked trailers would break verification); limine.conf
lists both ahead of the service chain. aarch64/riscv64 staging
deferred — the create-init arm never fires there (absent manifest ⇒
legacy boot; STATUS.md carries the step-8 revisit trigger, including
verifying riscv initrd module-address semantics before enabling the
phys conversion).
cambios-manifest: INIT_MODULE_NAME const; the kernel-side
InitIdentity (AID + endpoint) is captured at transcription in
src/manifest.rs (BOOTSTRAP_PRINCIPAL lifecycle, like its sibling
tables). CLAUDE.md: Quick Reference gains
manifest / manifest-step7 / init targets (the `make manifest` line
was owed since step 2), and the load-bearing endpoint list gains
init=1 + the endpoint-0 sentinel note.
Verification: RUST_MIN_STACK=8388608 cargo test --lib --target
x86_64-apple-darwin — 926 passed; user/init 7/7 (both feature
states build); cambios-manifest 31/31; make check-all — three arches
clean; make check-clippy — tri-arch 0 warnings; make
check-boot-panics — 0 flagged (create-init path fully typed); make
check-unsafe-coverage — 0 new (2 new SAFETY-documented blocks); make
run-quiet ×3 — 8.9s green with the banner chain above; make
check-deferrals — 485, 0 new (init's status print reworded rather
than growing the baseline; 6 symmetric line-shift pairs refreshed);
make check-assumptions — 307, 0 new (MANIFEST_MAPPING_BUDGET is
derived + tagged at site); make check-adrs OK. Pre-existing fs
test-code warnings (flagged at step 5) remain, untouched.
Staged files:
- CLAUDE.md
- Makefile
- STATUS.md
- cambios-manifest/src/lib.rs
- limine.conf
- src/boot/error.rs
- src/manifest.rs
- src/microkernel/main.rs
- tools/build-manifest/src/main.rs
- tools/check-deferrals-baseline.txt
- user/init/Cargo.toml
- user/init/src/main.rs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent a413f22 commit dfcd8f4
12 files changed
Lines changed: 408 additions & 24 deletions
File tree
- cambios-manifest/src
- src
- boot
- microkernel
- tools
- build-manifest/src
- user/init
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
| |||
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
458 | | - | |
| 461 | + | |
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
753 | 768 | | |
754 | 769 | | |
755 | 770 | | |
| |||
830 | 845 | | |
831 | 846 | | |
832 | 847 | | |
833 | | - | |
| 848 | + | |
834 | 849 | | |
835 | 850 | | |
836 | 851 | | |
| |||
863 | 878 | | |
864 | 879 | | |
865 | 880 | | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
866 | 888 | | |
867 | 889 | | |
868 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
0 commit comments