Repository navigation
guest: hand layered init control to the managed runtime - #1421
Pedro Henrique Penna (ppenna) merged 17 commits into
Conversation
Keep prepared mapping handles and the host table intact when handing them to the shared dispatcher. Read only the CLI-owned workload identity while retaining the resolved account defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Share the init token grammar so carriage returns and form feeds cannot create extra identities. Cover those cases and check that CLI IDs reach the native execution request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Adopt prepared layered mappings and the init-owned collector through the existing control dispatcher. Keep framing and legacy sandbox policy in place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Cover fragmented control input, helper failure versus SIGTERM and terminal status delivery before native driver events. Reuse the existing outer-record reader and run explicitly selected ignored proofs in isolated subprocesses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Keep helper failure policy and the first launch and cleanup diagnostics while the existing dispatcher settles an owned failed child. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Accept a zero-mapping root without an export, reject a positive table without its retained export, and keep unexpected MAPS on the existing accounting path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Keep direct prelaunch collection outside the launch-error conversion so a pending SIGTERM or helper failure ends the session without a false launch-failed response. Exercise both after receiving and crediting a complete EXEC, and keep the helper-failure host test on the existing fake diagnostic boundary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Keep the switched root and retained mapping handles alive while the existing managed dispatcher serves init control with the same Runtime. Remove the now-used wake and dispatcher hook allowances. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
The shared control loop now polls Runtime directly. Retain the old helper and signal scripts as test-only waiting fixtures instead of a second unused production wait path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Reuse the native host control driver for a dedicated PID-1 layered boot fixture. Check CLI identity and account defaults, retained zero or ordered mappings across reset, cancellation and clean shutdown without changing the existing default scenario. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4f77d672-f979-4d98-9305-63a5f57ae08c
This pull request changes existing testsIt modifies or removes 12 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests. Test codeRelocated unchanged: 3; added: 60. Compared the merge base |
There was a problem hiding this comment.
🟡 Changes recommended
A critical blocking control-output write can leave PID 1 unable to handle shutdown or helper failure when the host stops draining output, requiring nonblocking writes and backpressure regression coverage.
1 open issue
What changed in this PR
This PR advances #1116 by routing nvx-init’s prepared layered roots through the managed agent’s existing control dispatcher, sharing execution and mapping handling with blockless VMs while retaining init-owned shutdown and helper supervision.
Changes:
- Pass retained mapping handles, CLI identity, and account defaults into the managed dispatcher.
- Integrate init’s status collector and signal handling into control reads and workload execution.
- Add layered-runtime regressions and lifecycle checks, while moving the obsolete idle-loop driver into test-only code.
| File | Description |
|---|---|
scripts/test-layout-allowlist.json |
Tightens init’s test-hook allowance. |
nvx-rs/tests/managed_lifecycle.rs |
Adds real layered-init mapping, identity, reconnect, and cancellation checks. |
nvx-rs/src/guest/sys/process/tests.rs |
Allows explicitly selected ignored tests in isolated children. |
nvx-rs/src/guest/managed_agent/tests.rs |
Tests layered CLI identity parsing. |
nvx-rs/src/guest/managed_agent/session.rs |
Integrates init supervision and status retention into control reads. |
nvx-rs/src/guest/managed_agent/mappings/tests.rs |
Tests retained-export requirements. |
nvx-rs/src/guest/managed_agent/mappings.rs |
Adopts prepared layered mapping state and handles. |
nvx-rs/src/guest/managed_agent/exec.rs |
Routes workload collection through the shared session. |
nvx-rs/src/guest/managed_agent/dispatch/tests/runtime.rs |
Adds privileged shutdown, helper-failure, and status-ownership regressions. |
nvx-rs/src/guest/managed_agent/dispatch/tests.rs |
Shares harness helpers and tests layered dispatch. |
nvx-rs/src/guest/managed_agent/dispatch.rs |
Adds layered configuration and runtime-backed serving. |
nvx-rs/src/guest/init/tests.rs |
Keeps idle-loop test drivers outside production code. |
nvx-rs/src/guest/init.rs |
Replaces the production idle loop with managed dispatch. |
Review effort: Balanced
Make only runtime-backed control descriptors nonblocking and wait for writable readiness alongside the existing Runtime signal descriptor. Keep helper failure and SIGTERM handling live without polling on a timer or changing legacy sessions. Retain leader statuses collected during writes and hand them to the execution driver before each event. Preserve orderly termination during ATTACH and reset acknowledgement as well as workload output. Add focused readiness, backpressure, helper-precedence, pending-termination and write-collected-status regressions without relaxing existing checks or hooks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 190278d5-cbae-4ec6-b47d-ddf469124598
Move the new poll regression out of the existing assertion's token tree so Linux unit tests compile and the test inventory discovers it independently. Keep the original ordering assertions and the readiness regression unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 190278d5-cbae-4ec6-b47d-ddf469124598
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to PID-1 control, reaping, and shutdown across switch-root require privileged regression tests and real layered-init boot validation that remain pending and cannot be established by source inspection alone.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Convert the bounded header slice using the existing session-test pattern so the Linux-only regression compiles against the fixed-size protocol decoder. Keep all framing assertions and production behavior unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 190278d5-cbae-4ec6-b47d-ddf469124598
There was a problem hiding this comment.
🔵 Needs a closer look
Production PID-1 control, child-status collection, and shutdown changes still await current-head privileged Runtime regressions and unhooked layered-init lifecycle validation on qualified hosts.
No open issues 🎉
Review effort: Balanced
A Linux loopback connect may choose its destination as its own source port before the guest publishes its listener. A normal close leaves that port in TIME_WAIT and blocks the host's later publication. Share the existing listener client between cold-launch and clone scenarios and reset only that self-connection before retrying. Keep connect timing, read deadlines, and greeting assertions unchanged. Cover publication rebinding with a real self-connected TCP stream and a normal exchange. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0c16e8c2-e1da-4c5f-9b3b-5535db03b05b
Keep the original retry behavior when an ingress policy resets a connected client before peer inspection. Prove the race with a real reset socket, bound the positive listener control, and document the shared test fixture. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0c16e8c2-e1da-4c5f-9b3b-5535db03b05b
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because caching a ptrace stop can cause the leader’s terminal status to be discarded, producing a lost-status error instead of the actual termination result.
No open issues 🎉
Review effort: Balanced
061b99e
into
feature/nvx-refactor

Refs #1116
Hand the real layered init's retained root, control endpoint, CLI identity,
account defaults, mapper, and optional source root to the existing managed
dispatcher and runtime. Retain init-owned helper failure and shutdown behavior,
prelaunch ownership, cancellation, and the legacy sandbox path.
All twelve qualified SL7.6b commits were replayed exactly once directly onto
#1397 at
29fca59317ffb67d8a3c89061faddf224c086051, without conflicts,ancestor commits, or merges. Original messages, trailers, authors, patch
operations, modes and unsigned signature states are preserved. Their only
range-diff difference is unchanged allowlist hunk context from the new parent.
The OpenVMM pin remains
14dc4116.The independent review confirmed Copilot's blocking-output finding. The coupled
fix makes only runtime-backed control descriptors nonblocking and polls writable
readiness alongside the same Runtime's signal descriptor. It retains statuses
collected during writes, hands them to the execution driver before each event,
and preserves orderly termination during ATTACH and RESET acknowledgement.
Legacy sessions remain unchanged; no timer-retry workaround, second reaper,
public API or wire-format change was introduced.
The first fix commit accidentally placed the new poll regression inside an
assertion's token tree. The independent review caught this; the append-only
correction
9445f16bplaces it at module scope without changing its assertions.Actual Linux compilation then caught a slice/array mismatch in the new Runtime
test's frame decoder.
c7e97160uses the existing session-test conversion to thedecoder's fixed-size header type. Production and framing assertions are unchanged.
Both introduced test defects and their superseded results remain historical.
The full actual-base delta is 313 CORE, seven counted paths, fifteen raw paths:
twelve preserved commits plus three coupled fix commits. The user approved the
existing poll helper/test extension and necessary additional lines for this task.
All JSON and correction lines are counted, without extraction/category discounts.
Existing tests
The full structured comparison flags eight existing assets, relocates three
unchanged, adds 52 assets and extends one. The original seven flagged assets remain:
init::tests::{init,serve}keep the old helper/signal scripts in test-onlydrivers of production preparation, collection and shutdown.
Harness::spawn_atdelegates to a shared constructor for the same dispatcher.Harness::read_outerdelegates to the same extracted frame reader.isolate_process_testincludes ignored tests only in its exact named childinvocation, so privileged regression cases are actually runnable.
zero/two mappings, identity/defaults, reconnects and cancellation; its original
workload/shutdown checks remain.
Runtime::wakehook disappears with the idle loop; the existinginit hook allowance tightens from eight to seven.
The eighth flagged asset is the existing poll-order test: its expected readable
event also asserts
writable == false. New focused regressions cover writablereadiness/backpressure, SIGTERM and helper-failure precedence while output is
blocked, pending termination before ATTACH, and correct delivery of a status
collected during a write. No assertion, deadline or existing conditional skip was
relaxed. The new Runtime cases retain their real CAP_SYS_NICE/CAP_SYS_RESOURCE
prerequisite.
Validation
Current head:
c7e971607a0ea3b638800b4d90a3fd549685c42b.review 5832613919: COMMENTED, with zero unresolved review threads at the
final inspection. No formal approval is claimed.
The user approved the retained reviewer's audited read-only path; actual calls
and source/native/index immutability were checked. There was no technical
tool-deny fence, and this source-only review did not substitute for execution.
strict guard exit0 and no owned descendants. Standalone Python/quality passed:
1823 unit tests, 70 conditional skips, plus applicable lint/type/format,
layout, kernel-inventory and PowerShell checks, strict guard exit0.
The full all-feature library run passed 2091 tests, 51 ignored, with
default test parallelism. All 33 remaining Rust command rows passed, including
applicable MSRV/cross-target, public API, guest and adapter matrices.
CLI/quality passed 1823 unit tests, 30 conditional skips, Specula's
25 tests, and applicable shell/type/lint/layout/kernel/PowerShell checks.
including the four new regressions: one passed, zero failed, zero ignored
per invocation. These were current frozen-binary runs under narrowly approved
private-namespace privileges, not early-return skips or old-head evidence.
runtime-adapter guest were assembled and input/provenance checked. Native
OpenVMM/kernel inputs were reused only after matching provenance validation.
Eighteen host runners per platform were prebuilt and hash-bound; hardware
execution used a strict compiler-free bridge, with no own compiler/VM overlap.
Fresh hardware acceptance completed on Windows/WHP (user-declared bare metal)
and Pedro/MSHV (configured virtual machine):
Both backends ended with no owned VMMs. MSHV VMMs ran after dropping to UID1001,
not as root. The full MSHV operation and both WHP layered cases passed their
unchanged resource guards. The user explicitly authorized bypassing resource
guard/admission for the remaining WHP default and canonical tests. Those are
actual test passes under that exception, not resource-guard passes. Original
test assertions/deadlines, bounded execution, source/artifact checks, owned Job
containment and teardown checks remained in force; no global guard was changed.
Historical failures remain recorded, not waived or relabelled:
then an unmapped inherited process group (one failure). User-approved private
/tmpbinding and an own session/group before Bash PID1 corrected only the QAenvironment; the unchanged-source, default-parallel whole run then passed.
its guard with exit125. The separate whole confirmation passed the unchanged
guard; the earlier cause remains unproven. Superseded
9445f16balso retainsits E0308 test-helper compilation failure, Windows guard125 and telemetry
timeout; none qualifies this head.
9698af55passed its CI but retained the actionable blockingwrite finding. Its first Windows Python run had 63 failures, 29 errors and 71
skips, including DLL-initialization errors; their cause remains unproven.
The superseded
17ca29e3interruption and the original source's ETXTBSYhistory, conditional skips and limitations remain historical.
A separate red-baseline executable was not built or run. No performance
comparison is inferred from these acceptance results.
This PR remains Draft. Its current head received exactly one authorized
temporary Ready/full-CI/Draft cycle; no additional CI rerun was used for local
qualification. Final Ready and merge remain the user's decision.