Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nvx-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ nvx-rs/
| `nvx::host::filesystem` | The `ExportPlan` of host paths through OpenVMM's aggregate virtio-fs device, the host-mapping table, the reserved guest targets, and `guest_path` and `resolve_guest_path` (also at `nvx::`) |
| `nvx::host::store` | `SandboxStore`: the runtime records of one sandbox in a private directory with one lock, which every host that supervises the sandbox shares. The `RuntimeRecord` names the running VM: the `ProcessRef` of its VMM, its control endpoint, and the `RuntimeIdentity` that it was launched with, the identities of its OpenVMM, kernel, and initramfs from install or staging metadata and its boot and control contract versions, which decide whether another build of the host may reattach to it. The `LaunchJournal` of a launch holds a marker written before the spawn, the VMM's `ProcessRef` right after it, and an inherited claim on the VMM's log, which proves that a launch that never published its endpoint has exited, so that recovery ends an interrupted launch and signals only a VMM that it holds through a verified `Process`. Records are JSON in one versioned format, and records in any other format fail rather than being migrated |
| `nvx::host::instance` | `Instance`: a VM in a directory of its own. It starts OpenVMM with a fresh capability and waits until the guest is ready and has mounted the mapped paths, reconciles recorded state, recovers interrupted launches, runs workloads and pumps their output, and stops the VM with a forced fallback |
| `nvx::host::nvxs` | `HostConnection`: the host's role of the NVXS session over a platform transport. It attaches with the launch capability, waiting while the broker asks it to, sends application bytes in as many DATA records as they take, and returns each DATA payload from the guest, with deadlines; a receive that times out keeps a partial record |
| `nvx::host::nvxs` | `HostConnection`: the host's role of the NVXS session over a platform transport, on which `nvx::host::session` and other host applications run their protocols. It attaches with the launch capability, waiting while the broker asks it to, sends application bytes in as many DATA records as they take, and returns each DATA payload from the guest, with deadlines; a receive that times out keeps a partial record |
| `nvx::host::process` | The detached launch of OpenVMM, and verified process references. A `ProcessRef` names one process by its ID, its start time, and the `BootId` of the host boot during which it started. `Process::open` checks a reference and holds its process through a pidfd on Linux or a process handle on Windows, whether or not the caller started it, so that waits sleep until the process exits and termination never reaches a process that reuses its ID. A reference from an earlier boot names an exited process, and a process whose identity this user cannot check, such as another user's, makes `Process::open` fail rather than report an exit. Linux hosts without pidfds poll the reference instead, and cannot terminate the process |
| `nvx::host::session`, `platform`, `report` | The authenticated control session, Linux and Windows primitives, and OpenVMM's outcome report |
| `nvx::host::session`, `platform`, `report` | The authenticated control session, which carries NVX's control protocol, `NVXC`, one frame per DATA record of a `HostConnection`; Linux and Windows primitives; and OpenVMM's outcome report |
| `nvx::host::sandbox` | The launch profile of `nvx.py sandbox`, ported from the one that `scripts/nvx_tools/sandbox.py` held: `SandboxLaunch`, with the EROFS distro `SandboxLayer`, the one layer that a sandbox takes, the ext4 scratch disk, the entrypoint, arguments, hostname, workload identity, and resource limits, and its `--microvm-sandbox-block` and `--microvm-workload-identity` arguments and kernel command line, within the 1024-byte budget that OpenVMM leaves it. `mount`: `SandboxMount` live shares of host directories and files, their guest targets and the reserved ones, their access policies and owner, the aggregate of several shares, and the checks of their host paths. `options`: the checks that `nvx.py sandbox` and `nvx.py run` apply to their options: the attribution of `--mount-deny`, `--mount-allow`, and `--mount-write` to shares, the systemd policy, the targets of `nvx.py run` shares, and the managed exec environment; see [Python parity](#python-parity) |
| `nvx::testing::fake_openvmm` | A fake OpenVMM that serves the control console and runs scripted workloads without a VM, for direct launches and for the managed and one-shot sandboxes of `nvx-rs sandbox` and `nvx.py sandbox` |
| `nvx::host::cli` | Feature `cli`: the `nvx-rs` executable; see [The nvx-rs CLI](#the-nvx-rs-cli) |
Expand Down
7 changes: 5 additions & 2 deletions nvx-rs/src/guest/managed_agent/loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ impl BrokerCore {
.epoch
.checked_add(1)
.ok_or_else(|| io::Error::from(Errno::EOVERFLOW))?;
self.host_output.clear();
self.receive_credit = 0;
self.reset_guest()?;
self.queue_host(OUTER_RESET, 0, &[])
// The RESET ends the host's attachment with the session's new identity, after the
// records that the host has not read, at the next sequence number of the host's leg.
let sequence = self.host_send_sequence;
self.host_send_sequence = self.host_send_sequence.wrapping_add(1);
self.queue_host(OUTER_RESET, sequence, &[])
}

fn reset_guest(&mut self) -> io::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions nvx-rs/src/host/cli/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ impl Session {

/// Returns Python's message for a violation of the protocol that `nvx::host::session` reports.
///
/// The two sessions check the same records in the same order, and their messages differ only
/// where Python folds a case into a broader one.
/// The two sessions report the same violations of records that have one fault, and their
/// messages differ only where Python folds a case into a broader one.
fn protocol_message(message: String) -> String {
match message.as_str() {
"control attach response carried a payload" => {
Expand Down
4 changes: 3 additions & 1 deletion nvx-rs/src/host/cli/session/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ fn session_reset_is_not_a_closed_endpoint() {
// closure with which OpenVMM shuts down.
let (mut session, worker) = session_with(|guest| {
let _ = guest.request();
let reset = encode_outer(OUTER_RESET, &INSTANCE, 1, 0, &[]).unwrap();
// The reset starts the session's next epoch, at the next sequence number of the host's
// leg.
let reset = encode_outer(OUTER_RESET, &INSTANCE, 2, guest.sequence + 1, &[]).unwrap();
guest.stream.write_all(&reset, None).unwrap();
let _ = guest.record();
});
Expand Down
4 changes: 2 additions & 2 deletions nvx-rs/src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//! - [`store`] keeps the runtime records of a sandbox in a private directory with one lock: the
//! runtime record of its VM, with the VM's runtime identity, and the journal of its launch,
//! through which an interrupted launch is recovered without signaling an unverified process.
//! - [`session`] speaks the authenticated control protocol, and [`nvxs`] runs the host's role of
//! the NVXS session, which carries it and any other application protocol, over a platform
//! - [`session`] speaks NVX's control protocol, `NVXC`, over [`nvxs`], which runs the host's role
//! of the NVXS session for it and for any other application protocol, over a platform
//! transport. [`platform`] holds the primitives of Linux and Windows hosts. Other hosts compile
//! but report NVX as unavailable.
//! - [`process`] launches OpenVMM processes. Its verified process references name a process by
Expand Down
Loading
Loading