[FEATURE] Specify authenticated process and thread ownership #44

Closed
opened 2026-10-04 13:01:26 +02:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Parallel guest compiler/runtime consumers need genuine threads in one native process. Current kernel CLAIM attests one TCB and generation, while ordinary terminal/destruction paths retire that TCB's process authority. Counted same-ingress asynchronous calls already coexist, but cannot supply shared-process membership, independent thread masks/TLS, join or detach semantics.

Proposed behavior and scope

Publish the complete native process/thread ownership contract before changing ABI or runtime mechanisms. Define one original process lifetime with shared CSpace/VSpace and process policy, separate authenticated thread occupations, explicit construction authority and actual resource admission, start publication, thread exit versus process exit, exclusive join/detach, stack/TLS ownership and failure cleanup. Specify counted native origin framing and mediator enrollment without payload-derived thread authority. Document the implementation and producer/consumer sequence, including removal of obsolete singleton assumptions. This issue accepts the specification; runtime implementation remains tracked by the memory/runtime and local-socket designs.

Authority, security and reliability

Only an explicitly held, original-group-bound factory may construct members. Exact thread handles authorize their declared operations; numeric identities and packet bytes authorize nothing. Threads intentionally share their process's existing capability ceiling and mappings without minting root, Process, MAP or receiver authority. Thread exit retires its own original callers and execution storage; peers and process resources survive. Whole-process retirement drains every original thread/call before revoking group authority. Preserve nonwrapping generations, actual storage refusal before effects, original cleanup through uncertainty and strict W^X. Security, reliability and performance retain that priority.

Acceptance criteria

Checklist
  • Define separate original process/thread identities, shared address-space/capability ownership and process-versus-thread policy boundaries.
  • Define explicit construction/handle authority, exact enrollment and counted admission, including stale/foreign/absent authority denial before effects.
  • Define prepare/start/publication and cleanup through uncertain replies, source/stack/TLS lifetime and original occupation reuse.
  • Define ordinary thread exit, process-wide exit/kill, exclusive join, detach, cancellation, last-thread exit and terminal-event ownership.
  • Define stack guards, caller-owned stack handling, TLS/errno and complete architectural context ownership without hidden grants or fixed private limits.
  • Define authenticated native origin framing, mediator sharing with per-thread masks, process accounting, fork/exec interactions and coherent producer/consumer migration.
  • Record independent positive/negative/failure/capacity and native workload evidence requirements and relevant profiling boundaries; distinguish planned controls from executed evidence.
  • Publish component/manual contracts, immutable documentation adoption and linked reviews; reconcile phase tracking without accepting unimplemented thread/runtime mechanisms.

Alternatives and tradeoffs

Reject payload thread IDs, separate processes relabeled as a shared process, duplicated ClientSlot policy and receiver grants, ambient self-construction, spin-only joins and early stack/handle recycling. Retain the current scheduler's admitted execution placement; do not invent CPU authority. A shared process is one security domain, so capability sharing must be explicit rather than falsely described as isolation between peers. Runtime behavior and full imported-tool requirements remain implementation work.

Tracking and rollout

Memory/TLS/thread implementation, socket/runtime consumers, process behavior, libc, compatibility ELF/TLS and phase completion. Kernel, LibIPC, Posixd, Procd, loader/linker, memory services, libc and Integration must adopt the eventual native mechanism coherently. Tests, builds, lint, generated documentation, VM/profiler execution and CI observation remain deferred. Neither runtime thread support nor guest-build completion is claimed by specification acceptance.

Detailed scope and contracts

Native process/thread ownership specification — 4 October 2026

The complete ownership specification defines one original process with shared CSpace/VSpace, capability/fd/action/cwd/creation-mask policy and distinct authenticated native execution occupations. An explicitly sealed original-process factory and retained thread handles authorize Prepare/Start and cleanup; clients gain no global Process route, root or MAP grant. The actual original creator and counted enrollment precede Start. Native membership and caller origin never come from payload labels or copied ClientSlot policy.

The contract separates thread-only exit from process exit. Initial-thread departure preserves peers and shared resources. Last-thread preparation serializes creation/Start, settles potentially startable original members and retains the final context for process finalization. Whole-group retirement drains every original member/provider before shared authority reclamation and emits one process event. Join/detach arbitrate one original target, preserve joinability on cancelled uncommitted joins and reconcile committed disposition through reply loss without affecting a replacement generation.

Stack/guard, caller-owned storage, TLS/errno/module/destructor and complete architecture state have explicit original lifetime and reclamation boundaries. Current OIR1's 64-byte header uses bytes 56–63 for terminal status; the proposed versioned OIR2 extent is 72 bytes, adding thread identity/generation at 64–71. No runtime ABI/codec is changed by this specification. Mediator process policy remains shared while real enrolled threads own distinct masks/handlers. Fork/exec, native provisioning, target geometry, memory/loader/linker/libc and real workload adoption are coordinated requirements.

Integration's native lifecycle contract records independent actual membership, blocked-peer progress, initial/last exit, TLS/context, guards, join/detach, failure/reuse, group loss, profiling and tool-consumer evidence. The imported-tool source/version/options and transitive interface matrix remains unresolved. Current one-TCB asynchronous calls do not implement native shared-process threads.

Specification acceptance completes the ownership specification only. Native process/member/factory/origin mechanisms, thread-only exit, join/detach, per-thread TLS, libc/imported consumers and real profiling remain open. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed.

Three signed commits across Kernel, Docs and Integration publish 17 paths: 14 maintained documentation sources and three catalog files containing four selector updates. No runtime or Cargo source changes; no Rustfmt inputs. Read-only source/Git inventory records all 269 compiled edges and 162 catalog selections coherent, 4,346 code files below 1,000 lines, retained missing-docs gates, and 153 guards across 76 workflows. All 76 feature trees are clean except preserved Meta cache. Rootd and helper catalog entries retain independent compiled helper cc878220040dfa741491249434d6b8f8fe2252f7.

Signed documentation/adoption: docs af376f65, integration 5daf30c3, kernel 9660dacf.

Tracking: ownership specification, native implementation, socket consumers, libc, compatibility ELF/TLS, phase completion.

The complete ownership specification is source-accepted. Every native runtime, thread/TLS, imported consumer, profiling and guest-build implementation/evidence requirement retains its existing open scope.

Related records and contracts
Repository Links
docs PR 4
integration PR 12
kernel PR 3
## Problem and motivation Parallel guest compiler/runtime consumers need genuine threads in one native process. Current kernel CLAIM attests one TCB and generation, while ordinary terminal/destruction paths retire that TCB's process authority. Counted same-ingress asynchronous calls already coexist, but cannot supply shared-process membership, independent thread masks/TLS, join or detach semantics. ## Proposed behavior and scope Publish the complete native process/thread ownership contract before changing ABI or runtime mechanisms. Define one original process lifetime with shared CSpace/VSpace and process policy, separate authenticated thread occupations, explicit construction authority and actual resource admission, start publication, thread exit versus process exit, exclusive join/detach, stack/TLS ownership and failure cleanup. Specify counted native origin framing and mediator enrollment without payload-derived thread authority. Document the implementation and producer/consumer sequence, including removal of obsolete singleton assumptions. This issue accepts the specification; runtime implementation remains tracked by the memory/runtime and local-socket designs. ## Authority, security and reliability Only an explicitly held, original-group-bound factory may construct members. Exact thread handles authorize their declared operations; numeric identities and packet bytes authorize nothing. Threads intentionally share their process's existing capability ceiling and mappings without minting root, Process, MAP or receiver authority. Thread exit retires its own original callers and execution storage; peers and process resources survive. Whole-process retirement drains every original thread/call before revoking group authority. Preserve nonwrapping generations, actual storage refusal before effects, original cleanup through uncertainty and strict W^X. Security, reliability and performance retain that priority. ## Acceptance criteria <details> <summary>Checklist</summary> - [x] Define separate original process/thread identities, shared address-space/capability ownership and process-versus-thread policy boundaries. - [x] Define explicit construction/handle authority, exact enrollment and counted admission, including stale/foreign/absent authority denial before effects. - [x] Define prepare/start/publication and cleanup through uncertain replies, source/stack/TLS lifetime and original occupation reuse. - [x] Define ordinary thread exit, process-wide exit/kill, exclusive join, detach, cancellation, last-thread exit and terminal-event ownership. - [x] Define stack guards, caller-owned stack handling, TLS/errno and complete architectural context ownership without hidden grants or fixed private limits. - [x] Define authenticated native origin framing, mediator sharing with per-thread masks, process accounting, fork/exec interactions and coherent producer/consumer migration. - [x] Record independent positive/negative/failure/capacity and native workload evidence requirements and relevant profiling boundaries; distinguish planned controls from executed evidence. - [x] Publish component/manual contracts, immutable documentation adoption and linked reviews; reconcile phase tracking without accepting unimplemented thread/runtime mechanisms. </details> ## Alternatives and tradeoffs Reject payload thread IDs, separate processes relabeled as a shared process, duplicated ClientSlot policy and receiver grants, ambient self-construction, spin-only joins and early stack/handle recycling. Retain the current scheduler's admitted execution placement; do not invent CPU authority. A shared process is one security domain, so capability sharing must be explicit rather than falsely described as isolation between peers. Runtime behavior and full imported-tool requirements remain implementation work. ## Tracking and rollout [Memory/TLS/thread implementation](https://git.erikinkinen.fi/erix/kernel/issues/1), [socket/runtime consumers](https://git.erikinkinen.fi/erix/posixd/issues/34), [process behavior](https://git.erikinkinen.fi/erix/posixd/issues/3), [libc](https://git.erikinkinen.fi/erix/lib-cstd/issues/1), [compatibility ELF/TLS](https://git.erikinkinen.fi/erix/dynlinkd/issues/1) and [phase completion](https://git.erikinkinen.fi/erix/integration/issues/65). Kernel, LibIPC, Posixd, Procd, loader/linker, memory services, libc and Integration must adopt the eventual native mechanism coherently. Tests, builds, lint, generated documentation, VM/profiler execution and CI observation remain deferred. Neither runtime thread support nor guest-build completion is claimed by specification acceptance. <details> <summary>Detailed scope and contracts</summary> ### Native process/thread ownership specification — 4 October 2026 [The complete ownership specification](https://git.erikinkinen.fi/erix/kernel/src/branch/feature/posix-compat/docs/process-thread-ownership.md) defines one original process with shared CSpace/VSpace, capability/fd/action/cwd/creation-mask policy and distinct authenticated native execution occupations. An explicitly sealed original-process factory and retained thread handles authorize Prepare/Start and cleanup; clients gain no global Process route, root or MAP grant. The actual original creator and counted enrollment precede Start. Native membership and caller origin never come from payload labels or copied ClientSlot policy. The contract separates thread-only exit from process exit. Initial-thread departure preserves peers and shared resources. Last-thread preparation serializes creation/Start, settles potentially startable original members and retains the final context for process finalization. Whole-group retirement drains every original member/provider before shared authority reclamation and emits one process event. Join/detach arbitrate one original target, preserve joinability on cancelled uncommitted joins and reconcile committed disposition through reply loss without affecting a replacement generation. Stack/guard, caller-owned storage, TLS/errno/module/destructor and complete architecture state have explicit original lifetime and reclamation boundaries. Current OIR1's 64-byte header uses bytes 56–63 for terminal status; the proposed versioned OIR2 extent is 72 bytes, adding thread identity/generation at 64–71. No runtime ABI/codec is changed by this specification. Mediator process policy remains shared while real enrolled threads own distinct masks/handlers. Fork/exec, native provisioning, target geometry, memory/loader/linker/libc and real workload adoption are coordinated requirements. [Integration's native lifecycle contract](https://git.erikinkinen.fi/erix/integration/src/branch/feature/posix-compat/docs/native-thread-lifecycle.md) records independent actual membership, blocked-peer progress, initial/last exit, TLS/context, guards, join/detach, failure/reuse, group loss, profiling and tool-consumer evidence. The imported-tool source/version/options and transitive interface matrix remains unresolved. Current one-TCB asynchronous calls do not implement native shared-process threads. Specification acceptance completes the ownership specification only. Native process/member/factory/origin mechanisms, thread-only exit, join/detach, per-thread TLS, libc/imported consumers and real profiling remain open. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed. Three signed commits across Kernel, Docs and Integration publish 17 paths: 14 maintained documentation sources and three catalog files containing four selector updates. No runtime or Cargo source changes; no Rustfmt inputs. Read-only source/Git inventory records all 269 compiled edges and 162 catalog selections coherent, 4,346 code files below 1,000 lines, retained missing-docs gates, and 153 guards across 76 workflows. All 76 feature trees are clean except preserved Meta cache. Rootd and helper catalog entries retain independent compiled helper `cc878220040dfa741491249434d6b8f8fe2252f7`. Signed documentation/adoption: [docs af376f65](https://git.erikinkinen.fi/erix/docs/commit/af376f658022125af232de67c22427cd7554c202), [integration 5daf30c3](https://git.erikinkinen.fi/erix/integration/commit/5daf30c307a59d2df10a8c694f89d283b10deaf0), [kernel 9660dacf](https://git.erikinkinen.fi/erix/kernel/commit/9660dacf70b80cfce387046e5df6e54232f8619e). Tracking: [ownership specification](https://git.erikinkinen.fi/erix/kernel/issues/44), [native implementation](https://git.erikinkinen.fi/erix/kernel/issues/1), [socket consumers](https://git.erikinkinen.fi/erix/posixd/issues/34), [libc](https://git.erikinkinen.fi/erix/lib-cstd/issues/1), [compatibility ELF/TLS](https://git.erikinkinen.fi/erix/dynlinkd/issues/1), [phase completion](https://git.erikinkinen.fi/erix/integration/issues/65). The complete ownership specification is source-accepted. Every native runtime, thread/TLS, imported consumer, profiling and guest-build implementation/evidence requirement retains its existing open scope. </details> <details> <summary>Related records and contracts</summary> | Repository | Links | | --- | --- | | docs | [PR 4](https://git.erikinkinen.fi/erix/docs/pulls/4) | | integration | [PR 12](https://git.erikinkinen.fi/erix/integration/pulls/12) | | kernel | [PR 3](https://git.erikinkinen.fi/erix/kernel/pulls/3) | </details>
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:29 +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#44
No description provided.