Repository navigation
Map host paths and apply egress rules in the native-host backend - #419
Closed
Enrique Saurez (esaurez) wants to merge 8 commits into
Closed
Enrique Saurez (esaurez) wants to merge 8 commits into
Enrique Saurez (esaurez) wants to merge 8 commits into
Conversation
Load a separately supplied, caller-approved native host library for scratchless image-backed provision/start/exec/stop/deprovision. Keep the direct backend as default, isolate persisted state, fence unsupported capabilities, and pin the RAM-overlay OpenVMM change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bound guest-session disposal by each operation deadline, preserve zero as an unbounded command timeout while rejecting sub-second precision, keep native-only files outside direct-backend cleanup, and validate both derived Unix socket paths before loading the library. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show a concrete WHP invocation, the separately supplied artifacts and trust requirement, and the unverified MSHV path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OpenVMM serves one boot-console client at a time and retains guest output while none is connected. The native backend keyed its console listener by sandbox only, so a restart after an OpenVMM crash reused the finished listener of the crashed launch; with no listener, a verbose guest stalled until start timed out. A second backend instance that reattached to a running guest could not connect while the first one held the console, and stop then failed after the guest had already stopped. Key listeners by the OpenVMM process identity and retire stale ones before a launch. A listener that finds the console held elsewhere waits, without the start deadline, to take it over and ends quietly when OpenVMM exits; a reset after OpenVMM exits ends the log. Stop and deprovision report capture failures as consoleError metadata instead of failing. Extend the opt-in WHP suite with exec semantics, lifecycle errors and restarts, reattachment from a new backend, a crashed guest, a guest that outlives the process that started it, starts killed at several points, parallel sandboxes, and concurrent commands. List OpenVMM processes in a way that fails loudly, so the leak checks cannot pass vacuously. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hash the image once when it is registered, or record a digest that the caller already verified, and refer to it by content ID. Provision and start compare cheap file seals instead of hashing again, and fail closed when a file changed. Hash OpenVMM, the kernel, and the initramfs once per backend, optionally against approved digests, and keep full re-hashing as an opt-in diagnostic. Starts now cost about the guest boot time. Windows seals omit the change time: writers can set it, and the system updates it when it caches a file hash in an extended attribute, which failed an unchanged OpenVMM executable closed during testing. Claim the OpenVMM log before a native launch. OpenVMM inherits the claim, so recovery can clear an interrupted start that recorded no process identity once nothing holds the log, instead of leaving the sandbox unusable. Markers of the default backend are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The native-host backend accepts the same filesystem and network policies as the direct OpenVMM backend. Provision passes the policy to the host library's nvx_plan_sandbox export, which resolves mapped and denied paths, chooses the virtio-fs export, pins objects inside read-write mappings, and expands egress rules exactly. The sandbox record keeps the plan, and start hands it back through nvx_build_ramfs_launch_arguments_with_plan, which checks it again and fails with backend_error when a pinned object was replaced. The state root holds every sandbox's plan, which decides what the next start exports and which egress it allows. Provision therefore refuses a mapping inside the state root, and one that contains it unless a denied path hides it. The edge guest binds each mapping into its RAM overlay, configures the virtio-net device, and runs workloads as root with only the default container capabilities, no_new_privs, and no user namespaces, so the guest runtime ABI moves to microvm-abi-v2-edge-ramfs-v2. The opt-in guest tests run under the hypervisor that NVXHOST_TEST_HYPERVISOR names and cover mappings, the state root, denied and unmapped paths, containment, replaced host objects, the kernel command-line budget, and egress rules. The example accepts host-path and egress options. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On Linux the main thread of OpenVMM can exit and leave a zombie while its other threads still exit. Liveness checks treated that zombie as gone, so a stop returned while those threads still held OpenVMM's descriptors, and an immediate restart failed to claim the OpenVMM log that they kept locked. A zombie now counts as running until its other threads exit, as a Windows process runs until its last thread exits. The forced-stop guest test now uses a one-nanosecond stop timeout: on a fast host a graceful shutdown could complete within the previous millisecond. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OpenVMM refuses a guest address that is its network's own address, its broadcast address, or its first address, which is the gateway. The configuration accepted them, so a backend failed only when a sandbox first attached a network device, and the native backend reported its planning error as the request's policy_validation rather than as an unusable configuration. Creating a backend now rejects such an address with backend_unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Oct 7, 2026
Enrique Saurez (esaurez)
force-pushed
the
esaurez/nvxhost-edge-backend
branch
2 times, most recently
from
October 7, 2026 18:39
773621c to
7ed52d8
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #407 on the rebased stack. Stacked on #418. Gives the opt-in native-host backend the same
filesystemandnetworkpolicies as the direct OpenVMM backend.Summary
filesystemandnetworksections and passes them to the library's newnvx_plan_sandboxexport. The library resolves mapped and denied paths, chooses the virtio-fs export (the deepest common directory), pins the identity of every object inside a read-write mapping, and expands egress rules exactly. Validation uses the same export with a validate-only flag that touches nothing on the host; unenforceable policies fail withpolicy_validation.nvx_build_ramfs_launch_arguments_with_planexport, which reapplies every planning rule that needs no host access and refuses when a pinned object was replaced; start then fails withbackend_errorand asks for a new provision. The oldnvx_build_ramfs_launch_argumentsbinding is gone./etc/resolv.conf. Workloads stay root but keep only the default container capabilities, withno_new_privsand without user namespaces. The runtime ABI name moves tomicrovm-abi-v2-edge-ramfs-v2.OpenVmmConfig::guest_networknow rejects the network, broadcast, and gateway addresses, which OpenVMM refuses, when a backend is created (backend_unavailable), instead of when a sandbox first attaches a network device. This applies to both backends.NVXHOST_TEST_HYPERVISOR(defaultwhpon Windows) and drop theirwhp_prefix. New tests cover mappings, the state root, denied and unmapped paths, workload containment, replaced host objects, the kernel command-line budget, and egress rules against host services. The example takes--readonly,--readwrite,--denied,--egress,--egress-allow, and--egress-deny.Dependencies
--mount,--mount-deny, and--netwith the scratchless RAM-overlay topology.Changes since #407
OpenVmmConfig::guest_networkkeepsdev's canonical prefix parsing (cidr::parse_prefix_length) and adds the network, broadcast, and gateway checks to it.Validation
cargo test --all-featuresand Clippy with-D warningson all targets with--all-features, on Windows with Rust 1.93 (135, 137, 139, 139, and 140 unit tests).5b0a315), on Windows and on Linux with Rust 1.93: the crate's CI checks, which are fmt, Clippy with--all-featuresand with--no-default-features, tests with--all-featuresand with default features, docs with-D warnings,cargo +1.89 check, and, on Linux, the macOS build check. The pinned library test passes against freshly builtnvxhost.dllandlibnvxhost.so.--release --test-threads=1, each checking that no OpenVMM process outlives its sandbox, withdev's Linux 6.18.38 kernel:amd.milan.v1serves: all pass, in about 100 s, and again with a host profile;Notes