[FEATURE] Describe original loaded runtime image allocations #12

Open
opened 2026-11-13 14:21:34 +01:00 by erikinkinen · 0 comments
Owner

Problem and motivation

The loaded Kernel and its dependencies occupy separate firmware allocations. Original ELF catalog bytes and generic boot-memory exclusions cannot identify or authorize their relocated runtime pages. A native root must retain actual allocation custody and map only the intended segments.

Proposed behavior and scope

Add exactly known BootKernel 2.3 with critical flag 0x4, preserving all known 2.1/2.2 schemas. The 48-byte descriptor at offsets 240–287 counts 80-byte image records and 48-byte segment records. Startup and topology keep their existing positions; unused preceding slots are zero. Unknown revisions, flags, strides and nonzero reserved fields fail.

Each image identifies one exact original physical allocation, load bias, verified original ELF hash, segment partition and Kernel/dependency role. Each segment identifies its image, exact physical/virtual byte range, initialized and memory lengths, maximum read/write/execute permissions and normalized PTE cache selector. The selector describes paging policy; it does not assert a write-back effective memory type from selector zero. PAT/MTRR admission remains a native consumer responsibility.

Expose borrowed, checked records and a fallible encoder that validates the entire prospective structure before mutation. Retain whole allocations including holes; only exact segment pages may be mapped. Check complete arithmetic, allocation/segment relationships, conflicting backing/cache, effective writable-executable shared pages, reservation coverage and metadata overlap. No fixed image or segment ceiling is introduced.

Authority, security and reliability

Parsed metadata, hashes, exclusions and observed page-table leaves grant nothing. Only the original unsafe boot handover transfers real producer allocation custody into a unique runtime group, replacing rather than duplicating legacy Kernel-only ownership. Maximum permissions require enforcement in actual primary mappings; they do not prove global boot aliases are already confined.

The Bootloader must retain a real scoped allocation ledger, release partial loads before firmware exit, and transfer the complete owners only after successful exit. Every consuming root must retain the group through switch, invalidation and withdrawal. The Kernel BSS heap and its typed suballocations stay within their real image owner; startup stacks/tables, devices, framebuffer and physical windows retain separate authority boundaries.

Acceptance criteria

  • Implement the exact 2.1/2.2/2.3 selection matrix, counted image/segment views and preflighted encoder.
  • Cover literal offsets, preserved older schemas, malformed geometry/policy/reserved fields, allocation and metadata overlaps, shared-page policy, complete reservation coverage and unchanged output on refusal.
  • Document source identity versus custody, whole-allocation lifetime versus exact mapping, cache/PAT/MTRR duties and producer cleanup/transfer obligations in component docs and the technical manual.
  • Pass formatting, strict Clippy, unit tests, freestanding builds, rustdoc and current component CI without compiler warnings.

Alternatives and tradeoffs

A widened Kernel module would grant holes and misidentify independent allocations. A catalog-only or leaf-derived owner would fabricate custody. Counted allocation and segment tables retain the actual allocation unit while preserving precise mapping policy. Structural checks cannot replace original-entry ownership or native execution evidence.

Tracking and rollout

Build on the counted topology contract. See the implemented contract and technical manual. Coordinate the Bootloader allocation-ledger producer and Kernel original-entry intake with native private-root activation. Actual native image acceptance stays with those implementations; this component establishes the wire contract only.

## Problem and motivation The loaded Kernel and its dependencies occupy separate firmware allocations. Original ELF catalog bytes and generic boot-memory exclusions cannot identify or authorize their relocated runtime pages. A native root must retain actual allocation custody and map only the intended segments. ## Proposed behavior and scope Add exactly known BootKernel 2.3 with critical flag `0x4`, preserving all known 2.1/2.2 schemas. The 48-byte descriptor at offsets 240–287 counts 80-byte image records and 48-byte segment records. Startup and topology keep their existing positions; unused preceding slots are zero. Unknown revisions, flags, strides and nonzero reserved fields fail. Each image identifies one exact original physical allocation, load bias, verified original ELF hash, segment partition and Kernel/dependency role. Each segment identifies its image, exact physical/virtual byte range, initialized and memory lengths, maximum read/write/execute permissions and normalized PTE cache selector. The selector describes paging policy; it does not assert a write-back effective memory type from selector zero. PAT/MTRR admission remains a native consumer responsibility. Expose borrowed, checked records and a fallible encoder that validates the entire prospective structure before mutation. Retain whole allocations including holes; only exact segment pages may be mapped. Check complete arithmetic, allocation/segment relationships, conflicting backing/cache, effective writable-executable shared pages, reservation coverage and metadata overlap. No fixed image or segment ceiling is introduced. ## Authority, security and reliability Parsed metadata, hashes, exclusions and observed page-table leaves grant nothing. Only the original unsafe boot handover transfers real producer allocation custody into a unique runtime group, replacing rather than duplicating legacy Kernel-only ownership. Maximum permissions require enforcement in actual primary mappings; they do not prove global boot aliases are already confined. The Bootloader must retain a real scoped allocation ledger, release partial loads before firmware exit, and transfer the complete owners only after successful exit. Every consuming root must retain the group through switch, invalidation and withdrawal. The Kernel BSS heap and its typed suballocations stay within their real image owner; startup stacks/tables, devices, framebuffer and physical windows retain separate authority boundaries. ## Acceptance criteria - [x] Implement the exact 2.1/2.2/2.3 selection matrix, counted image/segment views and preflighted encoder. - [x] Cover literal offsets, preserved older schemas, malformed geometry/policy/reserved fields, allocation and metadata overlaps, shared-page policy, complete reservation coverage and unchanged output on refusal. - [x] Document source identity versus custody, whole-allocation lifetime versus exact mapping, cache/PAT/MTRR duties and producer cleanup/transfer obligations in component docs and the technical manual. - [x] Pass formatting, strict Clippy, unit tests, freestanding builds, rustdoc and current component CI without compiler warnings. ## Alternatives and tradeoffs A widened Kernel module would grant holes and misidentify independent allocations. A catalog-only or leaf-derived owner would fabricate custody. Counted allocation and segment tables retain the actual allocation unit while preserving precise mapping policy. Structural checks cannot replace original-entry ownership or native execution evidence. ## Tracking and rollout Build on [the counted topology contract](https://git.erikinkinen.fi/erix/lib-handoff/pulls/11). See [the implemented contract](https://git.erikinkinen.fi/erix/lib-handoff/pulls/13) and [technical manual](https://git.erikinkinen.fi/erix/docs/pulls/100). Coordinate [the Bootloader allocation-ledger producer](https://git.erikinkinen.fi/erix/bootloader/issues/33) and Kernel original-entry intake with [native private-root activation](https://git.erikinkinen.fi/erix/kernel/pulls/123). Actual native image acceptance stays with those implementations; this component establishes the wire contract only.
erikinkinen added this to the Alpha 1 milestone 2026-11-13 14:21:34 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/lib-handoff#12
No description provided.