[FEATURE] Retain original loaded kernel and shared-library allocations #33

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

Problem and motivation

The loader allocates separate physical storage for the running kernel and each resolved shared library, but handoff module metadata describes only the kernel's own virtual range. The kernel cannot retain library execution pages by treating source-file metadata or generic reserved memory as an image owner.

Proposed behavior and scope

Keep an original allocation ledger for the kernel and its actual transitive libraries. Publish a versioned runtime-image group with exact whole-allocation extents, verified source identities and exact loaded PT_LOAD segments. Retain allocation padding and holes as occupied storage while mapping only the real segment page union. Coordinate the wire contract and kernel's original-entry intake; preserve the independent startup and topology records.

Authority, security and reliability

Each successful UEFI allocation immediately enters a scoped owner before a later operation can fail. Keep original allocation custody through relocation, final mapping verification and firmware exit. Unpublished failures release created allocations in reverse order; uncertain cleanup fails closed while retaining custody. Only successful firmware exit transfers the actual original image group.

Descriptors, hashes, generic BOOTLOADER reservations and observed page tables cannot create owners. Preserve exact segment R/W/X intent and verify the applied leaf/cache policy; reject unsupported NX policy or conflicting shared pages. Do not map a virtual hull across holes or claim that this component removes all low identity aliases.

Acceptance criteria

  • Own kernel and actual transitive-library allocations from creation, including partial-load and relocation failures.
  • Reserve each complete original allocation and encode exact loaded segments and source identities through the coordinated codec.
  • Apply and verify supported segment execution/write/cache policy, including compatible shared pages and W+X refusal.
  • Preserve ownership through handoff rebuilds, exit retries and successful transfer without residual firmware cleanup handles.
  • Add source-owned allocation/refusal/policy controls and pass the original component gates.
  • Complete coordinated native image acceptance with the kernel intake; keep hosted codec/model results distinct.

Alternatives and tradeoffs

Widening the kernel module would misrepresent its source and map unrelated virtual gaps. Copying all supervisor mappings or treating reserved memory as authority would retain firmware and unrelated backing. An explicit original allocation group requires coordinated producer, wire and consumer changes but preserves the actual ownership boundary.

Tracking and rollout

Build on #32 and coordinate kernel#143 and kernel#123. Uses the runtime-image design and wire codec. Coordinate the original-entry consumer before native image acceptance. Keep existing approved producer and codec heads unchanged.

## Problem and motivation The loader allocates separate physical storage for the running kernel and each resolved shared library, but handoff module metadata describes only the kernel's own virtual range. The kernel cannot retain library execution pages by treating source-file metadata or generic reserved memory as an image owner. ## Proposed behavior and scope Keep an original allocation ledger for the kernel and its actual transitive libraries. Publish a versioned runtime-image group with exact whole-allocation extents, verified source identities and exact loaded PT_LOAD segments. Retain allocation padding and holes as occupied storage while mapping only the real segment page union. Coordinate the wire contract and kernel's original-entry intake; preserve the independent startup and topology records. ## Authority, security and reliability Each successful UEFI allocation immediately enters a scoped owner before a later operation can fail. Keep original allocation custody through relocation, final mapping verification and firmware exit. Unpublished failures release created allocations in reverse order; uncertain cleanup fails closed while retaining custody. Only successful firmware exit transfers the actual original image group. Descriptors, hashes, generic BOOTLOADER reservations and observed page tables cannot create owners. Preserve exact segment R/W/X intent and verify the applied leaf/cache policy; reject unsupported NX policy or conflicting shared pages. Do not map a virtual hull across holes or claim that this component removes all low identity aliases. ## Acceptance criteria - [x] Own kernel and actual transitive-library allocations from creation, including partial-load and relocation failures. - [x] Reserve each complete original allocation and encode exact loaded segments and source identities through the coordinated codec. - [x] Apply and verify supported segment execution/write/cache policy, including compatible shared pages and W+X refusal. - [x] Preserve ownership through handoff rebuilds, exit retries and successful transfer without residual firmware cleanup handles. - [x] Add source-owned allocation/refusal/policy controls and pass the original component gates. - [ ] Complete coordinated native image acceptance with the kernel intake; keep hosted codec/model results distinct. ## Alternatives and tradeoffs Widening the kernel module would misrepresent its source and map unrelated virtual gaps. Copying all supervisor mappings or treating reserved memory as authority would retain firmware and unrelated backing. An explicit original allocation group requires coordinated producer, wire and consumer changes but preserves the actual ownership boundary. ## Tracking and rollout Build on #32 and coordinate [kernel#143](https://git.erikinkinen.fi/erix/kernel/issues/143) and [kernel#123](https://git.erikinkinen.fi/erix/kernel/issues/123). Uses the [runtime-image design](https://git.erikinkinen.fi/erix/lib-handoff/issues/12) and [wire codec](https://git.erikinkinen.fi/erix/lib-handoff/pulls/13). Coordinate the original-entry consumer before native image acceptance. Keep existing approved producer and codec heads unchanged.
erikinkinen added this to the Alpha 1 milestone 2026-11-13 14:22:12 +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/bootloader#33
No description provided.