[FEATURE] Retain private address spaces through native process switching #123

Open
opened 2026-11-07 10:09:12 +01:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Native process execution needs hardware-isolated address spaces with explicit ownership through scheduling, faults and teardown. This is required for independent POSIX processes and the Alpha 1 microkernel demonstration.

Proposed behavior and scope

Retain private page-table roots and their real backing from creation through native entry and return. Each CPU must own its actual active, outgoing and transitioning roots. Preserve the Kernel, entry-stack and controller mappings required during a switch.

Coordinate this Kernel backend with target-memory construction and fault continuations. Existing source ownership remains required; a CR3 value or root identifier cannot construct an address-space owner.

Authority, security and reliability

Keep user mappings private and non-global. Borrow tables only through retained root resources and the original execution/selection source. Finish old-root user-packet borrows before switching. Preserve old and new root, frame and controller duties through failed preflight or partial transition.

Reclaim backing only after actual CPU departures and required TLB invalidations. Retain optional boot mappings only for their real users, and preserve valid module retirement. Source withdrawal, logical task state and reference counts alone do not prove hardware retirement.

Acceptance criteria

  • Own independent roots and backing; reject foreign-root borrowing and supervisor access before effects.
  • Preserve actual root custody through boot, AP entry, syscalls, IRQs, faults, NMI, idle and selected user return.
  • Preserve frames, user-buffer loans and controller EOI/rearm duties across refusal and partial root switches.
  • Support live mapping changes and teardown with actual local and remote translation retirement.
  • Retain and verify processor memory-type policy, including PAT, applicable MTRR state and cache controls, so Kernel, process and device aliases agree before CPU admission; reject mismatches and unilateral retyping.
  • Demonstrate overlapping user virtual addresses with different backing, contained faults and concurrent same/different-root execution on QEMU/OVMF with 1, 2 and 4 CPUs.
  • Cover allocation failure, revocation, stale-root reuse, transition reentrancy and repeated concurrency stress; update architecture and manual contracts.

Alternatives and tradeoffs

A shared root or an idle-state check does not establish private address-space ownership. Reuse the owned supervisor hierarchy and retained backing where their source and lifetime contracts suffice. Resolve root-slot reentrancy and optional Kernel-mapping lifetimes before accepting physical activation.

Tracking and rollout

Depends on the ownership work in #121 and coordinates with #122. Part of Alpha 1 completion. Enable native paths after the complete producer/consumer contract and physical acceptance agree.

  • Obtain topology through an original bounded firmware read source or a producer-owned snapshot. Validate every table span before following it; an RSDP address, checksum, identity mapping or RAM exclusion cannot supply backing authority. Preserve firmware memory provenance rather than granting reads over all coarse usable/reserved memory.
## Problem and motivation Native process execution needs hardware-isolated address spaces with explicit ownership through scheduling, faults and teardown. This is required for independent POSIX processes and the Alpha 1 microkernel demonstration. ## Proposed behavior and scope Retain private page-table roots and their real backing from creation through native entry and return. Each CPU must own its actual active, outgoing and transitioning roots. Preserve the Kernel, entry-stack and controller mappings required during a switch. Coordinate this Kernel backend with target-memory construction and fault continuations. Existing source ownership remains required; a CR3 value or root identifier cannot construct an address-space owner. ## Authority, security and reliability Keep user mappings private and non-global. Borrow tables only through retained root resources and the original execution/selection source. Finish old-root user-packet borrows before switching. Preserve old and new root, frame and controller duties through failed preflight or partial transition. Reclaim backing only after actual CPU departures and required TLB invalidations. Retain optional boot mappings only for their real users, and preserve valid module retirement. Source withdrawal, logical task state and reference counts alone do not prove hardware retirement. ## Acceptance criteria - [ ] Own independent roots and backing; reject foreign-root borrowing and supervisor access before effects. - [ ] Preserve actual root custody through boot, AP entry, syscalls, IRQs, faults, NMI, idle and selected user return. - [ ] Preserve frames, user-buffer loans and controller EOI/rearm duties across refusal and partial root switches. - [ ] Support live mapping changes and teardown with actual local and remote translation retirement. - [ ] Retain and verify processor memory-type policy, including PAT, applicable MTRR state and cache controls, so Kernel, process and device aliases agree before CPU admission; reject mismatches and unilateral retyping. - [ ] Demonstrate overlapping user virtual addresses with different backing, contained faults and concurrent same/different-root execution on QEMU/OVMF with 1, 2 and 4 CPUs. - [ ] Cover allocation failure, revocation, stale-root reuse, transition reentrancy and repeated concurrency stress; update architecture and manual contracts. ## Alternatives and tradeoffs A shared root or an idle-state check does not establish private address-space ownership. Reuse the owned supervisor hierarchy and retained backing where their source and lifetime contracts suffice. Resolve root-slot reentrancy and optional Kernel-mapping lifetimes before accepting physical activation. ## Tracking and rollout Depends on the ownership work in [#121](https://git.erikinkinen.fi/erix/kernel/issues/121) and coordinates with [#122](https://git.erikinkinen.fi/erix/kernel/issues/122). Part of [Alpha 1 completion](https://git.erikinkinen.fi/erix/integration/issues/65). Enable native paths after the complete producer/consumer contract and physical acceptance agree. - [ ] Obtain topology through an original bounded firmware read source or a producer-owned snapshot. Validate every table span before following it; an RSDP address, checksum, identity mapping or RAM exclusion cannot supply backing authority. Preserve firmware memory provenance rather than granting reads over all coarse usable/reserved memory.
erikinkinen added this to the Alpha 1 milestone 2026-11-07 10:09: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/kernel#123
No description provided.