Repository navigation
Map host paths and apply egress rules in the native-host backend - #407
Closed
Enrique Saurez (esaurez) wants to merge 3 commits into
Closed
Enrique Saurez (esaurez) wants to merge 3 commits into
Enrique Saurez (esaurez) wants to merge 3 commits into
Conversation
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 6, 2026
Contributor
Author
|
Superseded by #418, which carries this change on |
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.
Summary
Stacked on #395. Gives the opt-in native-host backend the same
filesystemandnetworkpolicies as the direct OpenVMM backend.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
9524065already combines--mount,--mount-deny, and--netwith the scratchless RAM-overlay topology.Validation (head
62ea619)cargo test --features nvxhost,testing,async(134 unit tests plus every integration suite) and the defaultcargo test(101 unit tests); Clippy with-D warningson all targets for both configurations;cargo +1.89 checkfor both.nvxhost.dllandlibnvxhost.so.--release --test-threads=1, every one checking that no OpenVMM process outlives its sandbox:no_new_privs, and EPERM for remount, mount, umount, unshare, and chroot;Notes