Repository navigation
fix(run): refuse shares that overlap the run's own VM directory - #1764
texasich (texasich) wants to merge 1 commit into
Conversation
refuse_own_files documents that 'run, which has no state directory, checks before it creates its VM directory and launches its VM', but run_cold never performed that check. A run whose share roots overlap (or contain) the run's temporary VM directory exposed the VM's own files - outcome.json, control.sock, console.sock, openvmm.log - to the guest through the share. Any ancestor-directory share (user profile root, /tmp) silently trips this. Resolve each share host path and the VM directory path and refuse bidirectional overlap before the directory is created, using the same error family and wording as the sandbox-side refuse_own_files check.
|
This pull request references no issue. Reference an issue of this repository on the first line of the description, as Commits and pull requests asks:
A maintainer can label a pull request that completes no issue, such as a release pin of the OpenVMM chain, |
|
texasich (@texasich) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
1 similar comment
|
texasich (@texasich) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
The Windows overlap check can miss containment when verbatim path prefixes differ, allowing an unsafe export, and the security-sensitive refusal lacks regression tests.
2 open issues
What changed in this PR
This PR adds share-overlap validation to cold runs, extending the protection already used by sandbox commands to the run’s temporary VM directory.
Changes:
- Resolve share roots and the planned VM directory before creating it.
- Reject overlapping paths with an
Unsupportederror to prevent exposing VM-owned files.
| File | Description |
|---|---|
nvx/src/host/cli/run.rs |
Adds path resolution and bidirectional overlap checks before VM directory creation. |
Review effort: Balanced
| let shared = paths::resolve(&child.root).map_err(|error| { | ||
| Exit::error(ErrorCode::Io, format!("cannot resolve the share host path {:?}: {error}", child.root)) | ||
| })?; | ||
| if shared.starts_with(&vm_path) || vm_path.starts_with(&shared) { |
| if let Some(export) = &config.filesystem { | ||
| for child in &export.children { |


Summary
refuse_own_files(nvx/src/host/cli/sandbox/mod.rs) documents: "run, which has no state directory, checks before it creates its VM directory and launches its VM." The sandbox paths (provision,start) call it, butrun_cold(nvx/src/host/cli/run.rs) never did - it createsnvx-run-<random>under the host temp directory with no share-overlap validation of the planned export.A run whose share roots overlap (or contain) the run's VM directory therefore exposes the VM's own files to the guest:
outcome.json,control.sock,console.sock,openvmm.log(the filesremove_vm_directorymanages), plus everything else written under the VM dir. Sharing any ancestor directory (user profile root,%LOCALAPPDATA%,/tmp) is a plausible operator action that silently trips this, whilesandbox run/startrefuse the identical condition - and therefuse_own_filesdoc comment already promises the check forrun.Changes
In
run_cold, after the VM directory path is computed and before it is created: resolve each planned share root and the VM directory withpaths::resolve, refuse bidirectional overlap withExit::error(ErrorCode::Unsupported, ...)using wording that mirrors the sandbox-side check. Validation-only; no behavior change for non-overlapping shares.cargo check -p nvxpasses on the patched branch.