[FEATURE] Implement real fork, exec, wait, signals and terminal process groups #3

Open
opened 2026-09-12 07:56:26 +02:00 by erikinkinen · 1 comment
Owner

Problem and motivation

Build tools and shell job control need real process snapshots, replacement, child status and signal delivery. A shell subshell checkpoint does not provide those semantics.

Proposed behavior and scope

Implement fork, exec, required spawn actions, wait, signals, groups/sessions and resource accounting across Posixd and the native process services. The fork snapshot contract defines the first boundary; native copying and libc remain implementation work.

Authority, security and reliability

Derive a fresh child inventory from original owners inside the sealed realm's ceiling. Share original open descriptions without copying service receivers, factories or pending grants. Bind control to live generations, validate user contexts and retain uncertain cleanup owners until positive retirement. Preserve the priority order: security, reliability, then performance.

Acceptance criteria

  • Specify the fork snapshot, both return paths, native/compatibility generations, shared descriptions and allowed capability inheritance.
  • Implement private address-space copying with selected memory and descriptor rights.
  • Publish the child atomically and unwind allocation, mapping, transfer and startup failures without damaging the parent.
  • Implement exec replacement with exact executable, manifest, realm, argv/env, descriptor and signal policy; preserve the old image on failure.
  • Implement required posix_spawn actions with equivalent inheritance rules, while retaining real fork.
  • Implement wait/waitpid, options, child status, zombie retirement, interruption and safe PID reuse.
  • Implement scoped groups/sessions and terminal foreground ownership.
  • Complete signal actions, masks, pending delivery, dispositions and unblock ordering.
  • Implement validated handler entry/return, required alternate stacks and async-signal-safe paths.
  • Complete EINTR/restart, SIGCHLD/wait ordering, SIGPIPE, stop/continue and terminal job control.
  • Complete real CPU/resource queries, child accounting and required limits.
  • Add native fork/exec/wait coverage for aliases, inheritance, environment, cwd, TLS, signals, threaded callers, failures and concurrent children.
  • Verify cross-realm control denial, stale identities, descendant cleanup and repeated exhaustion/recovery without residual authority.

Alternatives and tradeoffs

Start with eager private copying. Copy-on-write needs separate correctness, revocation and fault-lifetime evidence. A spawn-only implementation cannot satisfy the required resumed fork continuation.

Tracking and rollout

Dependencies: realm lifecycle, filesystem semantics, memory and threads. Reviews: Posixd, manual. Overall progress is tracked in Integration #65.

Coordinate producer/consumer versions on feature/posix-compat with signed commits. Cargo Git dependencies track main; catalogs and helper selections use full immutable commits. Native implementation, failure controls and guest execution must satisfy their own criteria before this issue closes.

## Problem and motivation Build tools and shell job control need real process snapshots, replacement, child status and signal delivery. A shell subshell checkpoint does not provide those semantics. ## Proposed behavior and scope Implement fork, exec, required spawn actions, wait, signals, groups/sessions and resource accounting across Posixd and the native process services. The [fork snapshot contract](https://git.erikinkinen.fi/erix/posixd/src/branch/feature/posix-compat/docs/fork-snapshot.md) defines the first boundary; native copying and libc remain implementation work. ## Authority, security and reliability Derive a fresh child inventory from original owners inside the sealed realm's ceiling. Share original open descriptions without copying service receivers, factories or pending grants. Bind control to live generations, validate user contexts and retain uncertain cleanup owners until positive retirement. Preserve the priority order: security, reliability, then performance. ## Acceptance criteria - [x] Specify the fork snapshot, both return paths, native/compatibility generations, shared descriptions and allowed capability inheritance. - [ ] Implement private address-space copying with selected memory and descriptor rights. - [ ] Publish the child atomically and unwind allocation, mapping, transfer and startup failures without damaging the parent. - [ ] Implement exec replacement with exact executable, manifest, realm, argv/env, descriptor and signal policy; preserve the old image on failure. - [ ] Implement required posix_spawn actions with equivalent inheritance rules, while retaining real fork. - [ ] Implement wait/waitpid, options, child status, zombie retirement, interruption and safe PID reuse. - [ ] Implement scoped groups/sessions and terminal foreground ownership. - [ ] Complete signal actions, masks, pending delivery, dispositions and unblock ordering. - [ ] Implement validated handler entry/return, required alternate stacks and async-signal-safe paths. - [ ] Complete EINTR/restart, SIGCHLD/wait ordering, SIGPIPE, stop/continue and terminal job control. - [ ] Complete real CPU/resource queries, child accounting and required limits. - [ ] Add native fork/exec/wait coverage for aliases, inheritance, environment, cwd, TLS, signals, threaded callers, failures and concurrent children. - [ ] Verify cross-realm control denial, stale identities, descendant cleanup and repeated exhaustion/recovery without residual authority. ## Alternatives and tradeoffs Start with eager private copying. Copy-on-write needs separate correctness, revocation and fault-lifetime evidence. A spawn-only implementation cannot satisfy the required resumed fork continuation. ## Tracking and rollout Dependencies: [realm lifecycle](https://git.erikinkinen.fi/erix/posixd/issues/1), [filesystem semantics](https://git.erikinkinen.fi/erix/posixd/issues/2), [memory and threads](https://git.erikinkinen.fi/erix/kernel/issues/1). Reviews: [Posixd](https://git.erikinkinen.fi/erix/posixd/pulls/5), [manual](https://git.erikinkinen.fi/erix/docs/pulls/4). Overall progress is tracked in [Integration #65](https://git.erikinkinen.fi/erix/integration/issues/65). Coordinate producer/consumer versions on `feature/posix-compat` with signed commits. Cargo Git dependencies track `main`; catalogs and helper selections use full immutable commits. Native implementation, failure controls and guest execution must satisfy their own criteria before this issue closes.
erikinkinen changed title from [FEATURE] [P09] Implement real fork, exec, wait, signals and terminal process groups to [FEATURE] Implement real fork, exec, wait, signals and terminal process groups 2026-09-12 08:02:05 +02:00
Author
Owner

The fork snapshot contract is published in 9a8f9ed6, with the matching manual update in d744f254. It specifies the two return paths, fresh identities, shared description lifetime, private-copy boundary, explicit capability inheritance and publication/cleanup ownership.

The specification criterion is complete. Native copying, runtime child admission, cross-process description storage, libc and the corresponding VM controls remain open.

The fork snapshot contract is published in `9a8f9ed6`, with the matching manual update in `d744f254`. It specifies the two return paths, fresh identities, shared description lifetime, private-copy boundary, explicit capability inheritance and publication/cleanup ownership. The specification criterion is complete. Native copying, runtime child admission, cross-process description storage, libc and the corresponding VM controls remain open.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:35:04 +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/posixd#3
No description provided.