Skip to content

host: add a peer-verified restore-ready listener - #1297

Draft
Enrique Saurez (esaurez) wants to merge 2 commits into
esaurez/slim-2.2.1-sl2.7-20261104from
esaurez/slim-2.2.1-sl2.17-20261105
Draft

Enrique Saurez (esaurez) wants to merge 2 commits into
esaurez/slim-2.2.1-sl2.7-20261104from
esaurez/slim-2.2.1-sl2.17-20261105

Conversation

@esaurez

Copy link
Copy Markdown
Contributor

Part of #1099

Stacked on #1280.

Adds an exact byte decoder for OPENVMM_RESTORE_READY_V1\n and a reusable
restore-ready listener. Linux and Windows endpoints are owner-only; receives
verify the peer against the held VM process, check liveness before and after
I/O, and reject changes to the expected identity. into_std transfers the
existing native listener without reopening it. Construction and blocking
receive remain crate-private; no restore sequencing or async framework is added.

Six counted files were approved for this PR, as #1076 allows where a split would
be harder to follow. The platform edits only expose existing endpoint mechanics
for reuse; existing clone behavior and tests are retained. The adjusted size is
168 core lines in six production files; the raw scan is 170 lines in seven
files, including two excluded lines of test-policy metadata.

Existing tests and wiring

  • nvx-rs/src/host/vm.rs: remove the fulfilled dead-code test hook from
    restore_ready_endpoint now that the listener uses it, and tighten its
    allowlist count.
  • scripts/test-layout-allowlist.json: allow the new restore module's three
    necessary future-call hooks for its crate-private bind, endpoint, and receive
    methods. Tests stay in their own module files; no assertions are relaxed.

New tests cover exact event bytes, real correct/rogue/exited child processes,
immutable expected identity, owner-only permissions, and native transfer after
an empty receive.

Validation

Local qualification uses the clean merge of this head with dev at
256ebe3d, without rebasing the stacked branch. Complete required Rust and CLI
checks passed on Windows and Linux, together with both API snapshots, Linux
quality checks, and freshly rebuilt native guests. The complete Python suite ran
1,810 tests on each OS. WHP and MSHV each passed all five public sandbox/snapshot
scenarios and all 156 canonical adapter scenarios across 11 targets, with
consumed artifact hashes unchanged.

Enrique Saurez and others added 2 commits November 5, 2026 12:22
Parse only the complete OpenVMM readiness event. Reuse the clone endpoint mechanics for private restore listeners, verify the held process during receives, and transfer native listeners without reopening them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e19737a6-412b-4652-b67e-b37837521925
Require a held-process liveness check after native peer PID matching. Keep temporary unused-code expectations active in unsupported-platform test builds, where the listener tests do not compile.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e19737a6-412b-4652-b67e-b37837521925
@esaurez Enrique Saurez (esaurez) added the tests-modified Changes existing tests, test data, or test wiring label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It 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

Change What Before After
removed hook the test hooks of fn restore_ready_endpoint in host::vm (impl VmDir) nvx-rs/src/host/vm.rs:121

Test policy

Change What Before After
loosened allowlist entry nvx-rs/src/host/restore.rs (the seams allow 3 test hooks) scripts/test-layout-allowlist.json

Relocated unchanged: 0; added: 26. Compared the merge base 935ec708cc1f with 955f32002c83.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical Linux authentication flaw allows an exited client's queued event to be accepted if its PID is recycled for the VM, requiring stable peer identification and a stale-peer regression test.

1 open issue
What changed in this PR

Adds a reusable restore-ready listener and exact event parser as part of the caller-owned VM lifecycle work in #1099. Construction and blocking receive remain internal; native listener transfer supports caller-managed I/O.

Changes:

  • Add exact decoding of OPENVMM_RESTORE_READY_V1\n.
  • Add owner-only endpoints, process checks, and native listener ownership transfer.
  • Add protocol and listener tests, documentation, and public API entries.
File Description
scripts/​test-layout-allowlist.json Update temporary test-hook allowances.
nvx-rs/​src/​protocol/​restore_ready/​tests.rs Test exact event bytes and malformed inputs.
nvx-rs/​src/​protocol/​restore_ready.rs Add the restore-ready event parser.
nvx-rs/​src/​protocol/​mod.rs Export the parser module.
nvx-rs/​src/​host/​vm.rs Remove the fulfilled endpoint dead-code allowance.
nvx-rs/​src/​host/​restore/​tests.rs Test process checks, endpoint privacy, and native transfer.
nvx-rs/​src/​host/​restore.rs Add the process-checked listener wrapper.
nvx-rs/​src/​host/​platform/​windows/​endpoint.rs Extract reusable pipe binding and add handle transfer.
nvx-rs/​src/​host/​platform/​linux/​endpoint.rs Add native Unix listener transfer.
nvx-rs/​src/​host/​mod.rs Export and document the restore module.
nvx-rs/​README.md Document parser and listener contracts.
nvx-rs/​public-api/​windows.txt Record the new Windows public API entries.
nvx-rs/​public-api/​linux.txt Record the new Linux public API entries.

Review effort: Balanced

Comment on lines +100 to +103
let open = self
.listener
.receive(process.reference().pid, received, limit, timeout)
.map_err(listener_error)?;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants