Repository navigation
host: hand owned cold-launch commands to callers - #1434
Pedro Henrique Penna (ppenna) merged 6 commits into
Conversation
This pull request changes existing testsIt modifies or removes 2 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 code
Relocated unchanged: 0; added: 8. Compared the merge base |
There was a problem hiding this comment.
🟡 Changes recommended
The Windows example can launch the VMM without its required log-named job when an untrusted object occupies that name, violating the launch contract and requiring a strict no-fallback spawn path with test coverage.
1 open issue
What changed in this PR
This PR advances the library-focused refactor by letting callers take ownership of a checked cold-launch command without reopening resources or rebuilding arguments.
Changes:
- Adds
Prepared::into_command(), an ownedVmmCommand, and platform-owned resource conversions. - Exposes status-bearing waits to host-only callers and adds ownership and exit-status regression tests.
- Adds a compiled external-launch example, documentation, and updated public API snapshots.
| File | Description |
|---|---|
nvx-rs/tests/checked_handoff.rs |
Tests actual exit statuses and repeated status reads. |
nvx-rs/src/host/vm/tests.rs |
Tests moved command data and resource identity. |
nvx-rs/src/host/vm.rs |
Adds owned launch commands and inherited-resource wrappers. |
nvx-rs/src/host/spawn.rs |
Exposes timed waits and documents process lifetime. |
nvx-rs/src/host/platform/windows/spawn.rs |
Enables Windows status waits without the CLI feature. |
nvx-rs/README.md |
Documents command ownership and example usage. |
nvx-rs/public-api/windows.txt |
Records the Windows public API additions. |
nvx-rs/public-api/linux.txt |
Records the Linux public API additions. |
nvx-rs/examples/external-launch.rs |
Demonstrates caller-owned launch and shutdown checks. |
nvx-rs/Cargo.toml |
Registers the host-feature external-launch example. |
Review effort: Balanced
123e93e to
874b16f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Failed process verification can leave an unverified, unrecorded VMM running because cleanup may abandon the child instead of confirming termination and reaping it, violating the setup-failure contract.
1 open issue
1 resolved since last review
Review effort: Balanced
00245fd to
4fdf55d
Compare
Move checked launch values and owned resources into VmmCommand without reopening them. Add standard owned-handle conversions and the compiled external cold-launch consumer, retaining the current merged preparation and spawn behavior. Expose the existing status-bearing launch wait for host-only callers and retain timeout, actual status and repeated-wait coverage. Public API snapshots will be generated during remote qualification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6789d491-7d13-4929-bc64-4edfec93ba60 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
Initialize the merged cold-boot capture option explicitly for the external launcher. Record the platform public API snapshots generated from the private source checkpoint. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6789d491-7d13-4929-bc64-4edfec93ba60 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
Expose the existing strict spawn path for caller-owned VM commands and use it in the external launcher, preserving the legacy spawn fallback. Exercise real Windows ACL, object-type and object-manager-link collisions before the process-creation window, and retain the permissive non-disk-log behavior only for ordinary spawns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5cb71c8-5f7f-4248-836b-4aae842c213d Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
Preserve the complete owned-command and strict-log-job handoff while replaying the PR onto the current feature input. Treat a missing exit proof as a timeout and propagate the outcome reader error before checking for a missing report. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5cb71c8-5f7f-4248-836b-4aae842c213d Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
Expose the existing strict child termination and confirmed-wait operation for external callers. Use it on example setup errors, preserve both failure messages, and cover running and already-reaped children through the public host-only API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5cb71c8-5f7f-4248-836b-4aae842c213d Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
Apply the repository rustfmt output from the pre-test formatting check without changing cleanup behavior or assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d5cb71c8-5f7f-4248-836b-4aae842c213d Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6a9302c-f126-4231-832e-22426190bd6b Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89997040-ff41-4516-a86a-d81422d5a79f
4fdf55d to
cfb4363
Compare
Rebased onto the current
|
213621f
into
feature/nvx-refactor

Part of #1076; implements the remaining SL2.8b slice of #1099.
Current settings integration
Current head is
4fdf55db0384354980a1267f64b5701d500969b8/ tree2db5b7cfaa040d45ff217596b554037d13ccd641, replaying only the six owned commits in4192cfd1..00245fd2onto immutable feature inputeba4c8b6a6a1dfe2ed1af4b11bcc35ec822483fe. The actual original remote00245fd2d464fbeb23eca84624585bbf6aa96794was captured before preparation and retained as the exact publication lease. OpenVMM remains14dc4116ec7e57567633c4b7b07892aca3a58522.The only manual conflict was adjacent README descriptions. Both complete descriptions survive; two rustdoc lines and a README note explain reading
nic()or buildingactivation_record(tx)before consumingPrepared. There is no new production or API logic reconciliation: the seven nonoverlapping owned source/test blobs remain byte-identical to00245fd2; the VM source and tests are the automatic union, apart from those two rustdoc lines. The incoming checked-settings/getter andcreatebodies match EBA4 exactly, andinto_command's complete ownership-transfer body matches00245fd2exactly. Every other incoming entry is retained. Both API listings are the exact additive union, retaining the command/supervisor and incoming settings entries. Snapshot compatibility, NIC, time and geometry code is unchanged.The strict trusted Windows log-job refusal before child creation, ordinary-spawn permissive behavior, confirmed cleanup/reaping, original error propagation, retained exit identity and external-example failure cleanup are all unchanged. No producer aggregate, old private partial, descendant or native history was replayed. Rebase-specific measured change: 0 new core lines and 0 new production files; the only novel edits are explanatory documentation.
Actual new-source compilation
This exact prepared head/tree passed before publication on both approved Linux and Windows hosts, using Rust/Cargo 1.95.0,
NVX_BUNDLE=skip, exact initialized native source and real task-private Git metadata.scripts/nvx.py verifypassed before Cargo. Linux completed at2026-11-10T22:25:01Zand Windows at2026-11-10T22:25:51.3296088Z. Each platform passed:Windows used native backslash paths and initialized MSVC in the same
cmd.exeprocess as each Cargo command. These are compilations, not test executions. Crate and adapter formatting passed on both hosts. Linux generated and compared both platform API snapshots successfully. The scoped layout, Markdown and test-accounting checks passed; module rows remain at most 188 characters. Against the selected feature input, the inventory remains 2 existing tests modified, 0 relocated and 8 added, all retained from the owned six. Theorigin/devinventory is inherited workstream accounting, not this PR's own test or execution count. Both owned drivers and their processes are closed, with private mutable targets/caches and fresh physical/commit/disk admission recorded.No tests, MSRV/full matrix, new native or manual Copilot review, kernel, guest or VM work was repeated solely for this unchanged logical replay. The private
d1c27903composition was an uncompiled reference only, never a donor or fresh quality proof. Historical F9's ordered positive reviews and affected checks stay F9-only. Separately, Main run 42898037924 passed on prior00245fd2with 34 successful jobs and 9 expected skips; it is not CI for this new head. Current-head automatic CI remains for the coordinator; no CI watch, merge, auto-merge or Ready/Draft transition is requested or performed.Preserved implementation and historical provenance
The complete corrected six-commit owned-command delta from original fork
cf5f91467c050f1e9508403964b1b4546e2724abthroughf9cdd2f55a176e892cca60726278d87b6036ad55is replayed onto actualfeature/nvx-refactorinput4192cfd1bbd2aa2a428fcb6eaa64ca042510ea62. That earlier head was00245fd2d464fbeb23eca84624585bbf6aa96794/ tree3a438ac6962a850bfca395dfa6656703fb5431e1, with unchanged OpenVMM gitlink14dc4116ec7e57567633c4b7b07892aca3a58522. The only manual conflict resolution combined adjacent README module rows, retaining the owned cold-command/confirmed-stop description and the current snapshot compatibility/NIC/time description. Both API listings retain their exact additive union. All nine owned non-documentation blobs and the complete logical owned delta are byte-identical to F9; all four incoming snapshot source/test blobs are identical to the feature input. No production or API behavior was reconciled or changed.Change
Prepared::into_command()moves the checked program, arguments, working directory, capability, outputs, inherited resources, opened log and Windows breakaway setting intohost::vm::VmmCommand.InheritedHandleowns its resource, accepts standard UnixOwnedFdor WindowsOwnedHandle, and provides borrowed views and ownership-preserving reverse conversions. Nothing is reopened, duplicated or rendered again.The compiled
external-launchexample consumes this command without a sandbox store. It checks the guest's boot marker and shell response, actual VMM exit status 0, a successful outcome and complete teardown. Status-bearingsupervisor::Launched::wait_timeoutis available to host-only callers. The example consumes the verifiedProcess::waitexit proof and propagates strict outcome-reader errors.The first Copilot finding was fixed by exposing and using the existing strict
supervisor::spawn_vmpath. On Windows an untrusted log-job name is refused before child creation instead of falling back without the required job. Ordinarysupervisor::spawnretains its existing permissive behavior. Both public-API snapshots include the strict entry point. Copilot's completed review on874b16f9resolved that first finding.The follow-up setup-failure cleanup finding is addressed by exposing and reusing the existing
Launched::kill_and_confirm_exitoperation. Its strict implementation is unchanged. Every post-spawn setup failure in the example uses confirmed termination/reaping and preserves both the original error and any cleanup error. Ordinary boundedkill_and_waitremains unchanged. This fix was published atf9cdd2f5; its positive after-check GitHub Copilot review completed on that exact F9 source. That review is historical F9 evidence, not a review of the newly replayed head.Directory privacy, creation/rollback, relative-input resolution, final command-line preflight and library VM spawn contracts remain intact. No restore implementation, new launcher framework, native pin change or unrelated parent/child rewrite is included.
Test changes
the_log_and_inherited_resources_stay_open_without_reopening_their_pathsto consume the owned inheritance wrapper, retaining its original-file and replacement-file assertions.Processobserves the child alive before cleanup and confirms exit afterLaunchedis consumed.NUL/pipe-log test to require strict rejection while retaining ordinary-spawn success assertions. No assertions, deadlines or existing coverage were weakened or retired.Earlier exact-00245 prepared-code compilation
The actual prepared
00245fd2d464fbeb23eca84624585bbf6aa96794/ tree3a438ac6962a850bfca395dfa6656703fb5431e1was compiled before publication on both approved hosts with Rust/Cargo 1.95.0,NVX_BUNDLE=skip, exact initialized OpenVMM source and real task-private Git metadata.scripts/nvx.py verifypassed before Cargo. Linux completed at 20:28:39 UTC and Windows at 20:30:08 UTC on 2026-11-10; both commands below exited 0 on each platform:Windows used native backslash paths and initialized MSVC in the same
cmd.exeprocess as each Cargo command. These commands compile the affected test and example targets without executing tests. Private targets/caches were used, and both owned drivers and their processes are closed. The mechanical README resolution passed the repository Markdown checker; every module row is at most 188 characters. No tests, native/manual Copilot review, MSRV matrix, VM, guest, kernel or OpenVMM runtime build was rerun solely for this unchanged rebase. Older execution/review tuples below are not relabeled as fresh results for this head.After preparation, the feature branch independently advanced to
db39a5d609eb6863f96a8c33f5e3fcaa71339e33with unrelated CLI-store liveness changes. An approved read-only merge-tree probe integrated that tip cleanly, preserving every incoming store entry and every owned entry byte-identically, with native14dc unchanged. Its hypothetical integration tree13d12c77edab2fbe7b45f59931a5a0f9d3bef5d6was not compiled or executed; the fresh both-host compilation above applies only to actual00245fd2d464fbeb23eca84624585bbf6aa96794. The original pinned input and F9 publication lease remain unchanged; no second replay was performed for target movement.Earlier exact-F9 validation
The following are actual executions of
f9cdd2f55a176e892cca60726278d87b6036ad55/ tree6df934ea36f0f13edcff7a2bcc426bac564323f2, on basecf5f9146with unchanged OpenVMM gitlink14dc4116.f9cdd2f5/ tree6df934ea, including the cleanup contract, unchanged strict-helper implementation, complete checked-handoff test and example bodies, and unchanged affected bodies bound by identical git blobs. That static review is separate from tests and GitHub Copilot review.1425bd32attempt failed formatting before compilation or tests. Linux1425bd32was never launched. The normalf9cdd2f5formatting successor is the input that actually passed the checks above; no earlier failed or unexecuted attempt is relabeled as passing.Counts are per command, not sums of distinct tests. Ignored tests are not runtime passes. No hardware VM, guest image, kernel or OpenVMM build/boot was run for this cleanup fix; the cold-runtime case remains explicitly ignored.
This PR is Ready, with that existing state preserved. The ordered exact-F9 round completed: positive Copilot review 5847760798 at 19:08:21 UTC; final affected checks on Windows at 19:46:28 UTC and Linux at 19:47:01 UTC; then after-check Copilot review 5848434774 at 19:56:48 UTC on 2026-11-10. The latter is an actual submitted
COMMENTEDreview recommending approval with no active or open issues, not formal human approval. These tests and reviews remain F9-only provenance. The unchanged mechanical replay does not repeat that ordered round. These historical results do not qualify the current settings-integration head. Current-head automatic CI remains a separate coordinator gate; no new CI result is claimed here. No merge or auto-merge is requested.Earlier validation provenance
b212ff2b: affected VM/spawn/process/report units 62 passed, 3 ignored; checked handoff 4 passed, 3 ignored. Source verification, formatting, Clippy variants, rustdoc, both-platform generated API comparison, MSRV, dependent adapter checks, explicit host-only example compilation, test layout and Markdown checks passed.ba55c7c0: focused real-name collision regression 1 passed; affected VM/process/report/inheritance/log-job tests 62 passed, 3 ignored; checked handoff 4 passed, 2 ignored. Source verification, formatting, Clippy variants, documentation, MSRV, dependent adapter checks, explicit host-only example compilation, test layout and Markdown checks passed. Owned-task process closure was recorded.874b16f9orf9cdd2f5. The snapshot-reader import updated an existing upstream VM-test fixture; no PR-owned production logic changed.874b16f9/ treee8876dcc/ basecf5f9146, including all seven then-affected test bodies and the incoming snapshot-opening API interaction. Unchanged bodies were explicitly bound by identical git blobs; the updated VM test file was read in full. This remains historical static-review evidence, not GitHub approval of the corrected head.Historical qualification only
The preserved
123e93edinput qualified the original handoff with compiled-example cold launches on MSHV and WHP, relative artifact inputs, real boot/shell markers, VMM and example exit status 0, successful outcome and complete teardown.Full CI for
123e93edpassed with 43 jobs: 34 successful and 9 expected skips, including the required status check and executed KVM, MSHV and WHP jobs. That run does not qualify this rebased source or any descendant.