Repository navigation
host: add a peer-verified restore-ready listener - #1297
Pedro Henrique Penna (ppenna) merged 5 commits into
Conversation
This pull request changes existing testsIt modifies or removes 5 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
Test policy
Relocated unchanged: 0; added: 31. Compared the merge base |
There was a problem hiding this comment.
🟡 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
935ec70 to
b93206a
Compare
ba92d50 to
0c5de2d
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Security-critical peer authentication depends on Linux and Windows semantics, and native PID-reuse, exited-peer, and ownership-transfer regression results still need confirmation beyond this source-only review.
No open issues 🎉
Review effort: Balanced
|
The native results requested by the current review were rerun on
Both platforms actually passed the real correct-process and rogue-process On Linux, Separately, fresh WHP and MSHV runs each passed the five public scenarios and |
0c5de2d to
691a7e7
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
This security-sensitive authentication boundary spans Linux pidfd/kernel behavior and Windows pipe lifetimes, requiring maintainer confirmation of platform guarantees and exact-revision native regression results.
No open issues 🎉
Review effort: Balanced
|
Current native regression evidence for exact head
These executed in the complete current local Rust commands, with explicit serial The rebase retained all four commits with equal patches, without conflicts or an This is exact-head native process/socket/pipe regression evidence, not a claim |
691a7e7 to
4a26858
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive peer authentication and listener transfer require native Linux PID-reuse and Windows overlapped-I/O validation tied to the exact reviewed source, which this source-only review cannot provide.
No open issues 🎉
Review effort: Balanced
|
Current native regression evidence for exact reviewed head
These ran in the complete current local Rust commands, with explicit serial Linux's Windows's native-transfer regression first performs an empty timed receive, The rebase retained all four commits and resolved only README adjacency, This is exact-head native process/socket/pipe evidence, not coverage of every |
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
Authenticate Linux restore-ready connections through SO_PEERPIDFD rather than a recycled peer credential PID. Fail closed when that capability is unavailable, and preserve the existing clone receiver. Document native callers' original-peer checks. Cover a queued client that exits before the VM starts and whose PID the VM reuses in a private PID namespace. Check unavailable and denied peer-pidfd capabilities through child-scoped seccomp filters without relaxing existing tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e19737a6-412b-4652-b67e-b37837521925
Classify the older kernel's EINVAL for a reaped socket peer as a protocol refusal, and preserve the held VM's Exited outcome before mapping a receive error. Keep the PID-reuse regression strict when user namespaces are refused: use passwordless sudo only for its private PID/mount helper, keep Bash as the reaper, validate both namespace identities and matching process users, and require proof that the critical body ran. Fail explicitly if neither isolation route works; never change host namespace policy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e19737a6-412b-4652-b67e-b37837521925
Carry only scripts/test_adversarial.py from #1278 at 5b7f85d. Wait for the fixture's actual live child before timing the workload, accept the existing raw or wrapped timeout, and await Windows fixture teardown. Keep the 0.5-second workload deadline and descendant-exit assertions. Production code and skip guards are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e19737a6-412b-4652-b67e-b37837521925
4a26858 to
f7c9763
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed to confirm kernel-specific authentication and ownership-transfer guarantees because native Linux PID-reuse and Windows named-pipe validation could not be independently verified in this source-only review.
No open issues 🎉
Review effort: Balanced
8e472f0
into
feature/nvx-refactor

Part of #1099
Stacked on #1280.
Adds an exact byte decoder for
OPENVMM_RESTORE_READY_V1\nand a reusablerestore-ready listener. Linux and Windows endpoints are owner-only; receives
verify the peer against the held VM process and check its liveness before and
after I/O.
into_stdtransfers the existing native listener without reopeningit. Construction and blocking receive remain crate-private; no restore
sequencing or async framework is added.
The new Linux receiver authenticates the original socket peer with
SO_PEERPIDFD, not a pidfd reopened from cached numeric credentials. An exitedclient's queued event cannot impersonate a later VM with a recycled PID.
Missing or denied kernel support fails closed as
Unavailable; this requirementis specific to the new receiver, not a general Linux minimum. The existing clone
receive path is unchanged.
The four logical implementation and follow-up commits are retained on the
updated parent. The original-peer authentication, older-kernel error mapping,
held-process exit precedence, and strict PID-reuse regression are preserved.
The full counted scope is 236 core lines in seven files: six production Rust
files and the required existing test-layout policy JSON. The original
six-production-file allowance has been extended only for that required metadata
path, with the 600-line ceiling unchanged. Its two changed lines are counted,
not exempted; no seventh production Rust file is authorized.
Existing tests and wiring
nvx-rs/src/host/vm.rs: remove the fulfilled dead-code test hook fromrestore_ready_endpointnow that the listener uses it, and tighten itsallowlist count.
nvx-rs/src/host/sys/process/tests.rs: extract the existing test-only seccompinstaller so the unchanged umask refusal test and the new selective peer-pidfd
denial test can share it. The umask filter and its assertions are preserved;
no production unsafe code or dependency is added.
scripts/test-layout-allowlist.json: allow the new restore module's threenecessary future-call hooks for its crate-private bind, endpoint, and receive
methods. Tests stay in their own module files; no assertions are relaxed.
scripts/test_adversarial.py: carry SL2.4a1: the root's kernel tokens carry what VmConfig sets, and the guest caps a RAM upper #1278's published test-fixture correction.Wait at most five seconds for real fixture readiness and an atomically
published live child PID before starting the unchanged 0.5-second workload
deadline. Accept the API's existing raw
TimeoutErroror wrappedRuntimeErrorwith the exact timeout message, preserve descendant-exitassertions, and wait for the Windows fixture child to exit after teardown.
Production code, workload deadlines, and skip guards are unchanged.
New tests cover exact/malformed bytes, real correct/rogue/exited child processes,
immutable expected identity, owner-only permissions, and native transfer after
an empty receive. Linux also exercises actual PID recycling after the original
queued peer exits and is reaped, plus missing/denied/stale peer-pidfd errors.
That regression verifies private PID and mount namespaces with a Bash reaper;
if unprivileged user namespaces are refused, only its isolated helper uses
passwordless
sudo. Failure of both setup routes is a real test failure, nevera skip or a passing early return.
Local validation
The updated #1280 parent and inherited OpenVMM revision have actual passing
Rust, CLI, API, and quality results, including 1,814 Python tests on each OS,
the adversarial and host-resolver suites, and newly assembled native guests
from the candidate's validated Rust binaries. WHP and MSHV each passed all five
public sandbox/snapshot scenarios and all 156 canonical adapter scenarios
across 11 targets, including setup and teardown, with the consumed artifact
hashes unchanged. Independent read-only review of the exact rebased source is
clear. These results remain evidence for their recorded inputs.
The canonical-CLI correction is now complete on the unchanged candidate.
Windows used the workflow's
clifeature and static CRT; Linux usedcliandthe static-musl target. Each platform passed the complete twelve-command action
under its whole-command compiler budget, including 1,814 Python tests
(67 Windows and 30 Linux recorded skips), all required real-CLI,
canceled-capture and native PowerShell cases, 84 adversarial tests, four resolver
tests and eight help probes. Linux PowerShell used normal globalization with
verified ICU, not invariant mode.
Both WHP and MSHV then passed all five public scenarios, setup and teardown,
and all 156 canonical adapter scenarios across 11 targets against the new CLI
artifacts. There were no failed or ignored adapter scenarios; all 34 consumed
input hashes remained unchanged, including the 14 retained non-CLI inputs.
Original CLI paths and earlier results remain attributed to their original
inputs; explicit canonical outputs were used for this qualification, not a
claim that default-path packaging changed.
The first Linux evidence-auditor attempt failed after misreading a passing
test's two-line description; its raw failure is retained, and the complete
action passed after correcting only that auditor. The Windows compiler gateway
also recorded cleanup of its owned MSVC telemetry process after successful
commands; this is not represented as a zero-warning run. Optional unprepared
kernel-source and unelevated Windows ownership prerequisites remain recorded
skips, not passes. Native listener/PID-reuse controls and the exact-source
independent review remain valid at their recorded inputs. These are local
results, not a CI, KVM, macOS-runtime, performance or enclosing-group pass.