[FEATURE] Add Kernel return and writer proofs to cleanup frame analysis #19

Open
opened 2026-10-15 14:28:22 +02:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Exsh's cleanup frame checker treats syscalls as opaque because it has no checked
description of the selected Kernel's return paths and memory writes. This
prevents it from preserving otherwise known register and stack facts across a
query. The broader frame-proof work remains tracked in Exsh #4.
The compiler invocation owner addresses producer custody and leaves
Kernel effects open; this proposal supplies that separate proof domain.

Proposed behavior and scope

Extend Exsh's static proof model with an explicitly selected Kernel programme
context and a return/writer contract. The contract must apply to any task
satisfying its checked entry conditions, carrying the original task generation,
saved frame and occupied user stack through the complete call and return.

The first implementation milestone covers one native query_local_cap action,
one actual Exsh profile and one matching Kernel configuration. Include its
unconditional retirement work, final accounting and machine-state restoration.
Other syscalls and unmatched configurations retain their existing refusal.

Authority, security and reliability

The Kernel retains ownership of task identity and mappings. Host file capture
and process observation confer no guest authority. Derive the action and its
effects from the selected programme; names, ABI assumptions, copied identities
and caller-written receipts cannot establish preservation.

Keep loader and memory-safety premises explicit. Cover aliases, asynchronous
writers, generation reuse, mapping retirement and error paths. Unknown effects
remain refusals. Preserve the checker’s resource accounting, cleanup and first
error handling. Apply security, reliability, then performance.

Acceptance criteria

  • Extend the existing producer/input contract with explicit intake for the
    complete selected Kernel programme, native dependencies, configuration and
    relocations, preserving original ownership and declared trust boundaries.
  • Complete the first query milestone: derive the actual action and
    arguments, and prove an invariant linking the original task generation to
    its saved frame and live user stack across every reached writer and
    retirement path.
  • Prove ordinary return to that same execution. Distinguish failed,
    terminal and switched-task paths; retain unresolved callees and executed
    relocation assumptions as explicit dependencies.
  • Consume the completed relation at the actual Exsh instruction context.
    Keep syscall effects opaque whenever the action, programme or lifetime
    premises do not match; do not introduce an unconditional preservation mask.
  • Add meaningful positive controls and refusals for changed generations,
    stack aliases, premature mapping release, unknown writers, mixed artifacts,
    altered relocations, malformed arguments and incomplete cleanup.
  • Report the exact consumed proof dependencies and remaining refusals.
    Demonstrate the first milestone with real selected native artifacts while
    preserving independent source, stack and mapping requirements.
  • Document the new contract and affected architecture/manual interfaces.
    Measure checker time and memory against the existing profile before making
    performance claims or changing resource policy.

Alternatives and tradeoffs

Keeping syscalls opaque remains safe while this work is incomplete. ABI-based
preservation or a wrapper allowlist would leave the Kernel's writers unproved.
Per-execution guest snapshots would change the static checker's domain and
would not establish a universal return contract. Starting with one query and
configuration gives a complete first milestone before extending coverage.

Tracking and rollout

This is a focused design dependency of Exsh #4, with Kernel lifetime
and authority review under Kernel #2. The broader issues retain
their existing acceptance criteria. Reuse the original producer/input ownership
work in Exsh #15.

Coordinate Exsh PR #3 and Kernel PR #3. Establish the
programme and lifetime proof interfaces first, then implement and review the
single-query milestone before enabling its use in the checker. Track wider
integration under Phase 6 completion.

## Problem and motivation Exsh's cleanup frame checker treats syscalls as opaque because it has no checked description of the selected Kernel's return paths and memory writes. This prevents it from preserving otherwise known register and stack facts across a query. The broader frame-proof work remains tracked in [Exsh #4][frames]. The [compiler invocation owner][producer] addresses producer custody and leaves Kernel effects open; this proposal supplies that separate proof domain. ## Proposed behavior and scope Extend Exsh's static proof model with an explicitly selected Kernel programme context and a return/writer contract. The contract must apply to any task satisfying its checked entry conditions, carrying the original task generation, saved frame and occupied user stack through the complete call and return. The first implementation milestone covers one native `query_local_cap` action, one actual Exsh profile and one matching Kernel configuration. Include its unconditional retirement work, final accounting and machine-state restoration. Other syscalls and unmatched configurations retain their existing refusal. ## Authority, security and reliability The Kernel retains ownership of task identity and mappings. Host file capture and process observation confer no guest authority. Derive the action and its effects from the selected programme; names, ABI assumptions, copied identities and caller-written receipts cannot establish preservation. Keep loader and memory-safety premises explicit. Cover aliases, asynchronous writers, generation reuse, mapping retirement and error paths. Unknown effects remain refusals. Preserve the checker’s resource accounting, cleanup and first error handling. Apply security, reliability, then performance. ## Acceptance criteria - [ ] Extend the existing producer/input contract with explicit intake for the complete selected Kernel programme, native dependencies, configuration and relocations, preserving original ownership and declared trust boundaries. - [ ] Complete the first query milestone: derive the actual action and arguments, and prove an invariant linking the original task generation to its saved frame and live user stack across every reached writer and retirement path. - [ ] Prove ordinary return to that same execution. Distinguish failed, terminal and switched-task paths; retain unresolved callees and executed relocation assumptions as explicit dependencies. - [ ] Consume the completed relation at the actual Exsh instruction context. Keep syscall effects opaque whenever the action, programme or lifetime premises do not match; do not introduce an unconditional preservation mask. - [ ] Add meaningful positive controls and refusals for changed generations, stack aliases, premature mapping release, unknown writers, mixed artifacts, altered relocations, malformed arguments and incomplete cleanup. - [ ] Report the exact consumed proof dependencies and remaining refusals. Demonstrate the first milestone with real selected native artifacts while preserving independent source, stack and mapping requirements. - [ ] Document the new contract and affected architecture/manual interfaces. Measure checker time and memory against the existing profile before making performance claims or changing resource policy. ## Alternatives and tradeoffs Keeping syscalls opaque remains safe while this work is incomplete. ABI-based preservation or a wrapper allowlist would leave the Kernel's writers unproved. Per-execution guest snapshots would change the static checker's domain and would not establish a universal return contract. Starting with one query and configuration gives a complete first milestone before extending coverage. ## Tracking and rollout This is a focused design dependency of [Exsh #4][frames], with Kernel lifetime and authority review under [Kernel #2][kernel-audit]. The broader issues retain their existing acceptance criteria. Reuse the original producer/input ownership work in [Exsh #15][producer]. Coordinate [Exsh PR #3][exsh-pr] and [Kernel PR #3][kernel-pr]. Establish the programme and lifetime proof interfaces first, then implement and review the single-query milestone before enabling its use in the checker. Track wider integration under [Phase 6 completion][phase]. [frames]: https://git.erikinkinen.fi/erix/exsh/issues/4 [kernel-audit]: https://git.erikinkinen.fi/erix/kernel/issues/2 [producer]: https://git.erikinkinen.fi/erix/exsh/issues/15 [exsh-pr]: https://git.erikinkinen.fi/erix/exsh/pulls/3 [kernel-pr]: https://git.erikinkinen.fi/erix/kernel/pulls/3 [phase]: https://git.erikinkinen.fi/erix/integration/issues/65
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:49 +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/exsh#19
No description provided.