From f9b9a156746b147881d77d9221aa4ae9c0717504 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 21 Nov 2026 16:42:50 -0800 Subject: [PATCH 1/4] openvmm: pin the refusal of microVM file children that it cannot name OpenVMM's microVM virtio-fs server opens the host directory of an aggregate's file child as a strict volume whose root object is the file, at its name, and a strict volume refuses every path with `\` or `:`. Nothing checked the file's name when the child attached, so a file child whose host file's name had one, as in a timestamp or a digest on Linux, or a Windows path that names an alternate data stream, attached without an error, but every guest lookup of it failed with EINVAL, and so did a READDIRPLUS of the aggregate's root from the child on (microsoft/nvx#1614). Pin microsoft/openvmm afa0e9c20a7943d3ec556098d9272f4ee502bdd4, one commit on 5c82edac4, the head of microsoft/openvmm#5208, which stacks on microsoft/openvmm#5207 and feature/microvm/dev 32888344a: - virtiofs: refuse a microVM file child that its volume cannot name. Attaching an aggregate fails, at a cold boot or a restore, with an error that names the file, when a file child's name holds `\` or `:`, which the volume would refuse as a path. Directory shares and children, and a file in a directory whose name has a colon, are unchanged. Its test fails without the change on Windows and on Linux (nvx-kvm-test). No saved state, protocol, ABI, or format, and no version of any of them, changes. The protocol vectors and CPU profiles that nvx copies are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- openvmm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvmm b/openvmm index 5c82edac4..afa0e9c20 160000 --- a/openvmm +++ b/openvmm @@ -1 +1 @@ -Subproject commit 5c82edac42ca480d546459e019860759a27c2211 +Subproject commit afa0e9c20a7943d3ec556098d9272f4ee502bdd4 From 135891f5bb9571106530c2398c51a54515b421f6 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 21 Nov 2026 14:57:57 -0800 Subject: [PATCH 2/4] doc: say that the VMM refuses a file child with a backslash or colon OpenVMM's microVM virtio-fs server refuses `\` and `:` in every path of a share, and a file child's volume reaches its file by the file's name, so a file child whose name has one attached but stayed unreachable: every guest lookup of it failed with EINVAL (#1614). The pinned OpenVMM now refuses such a child when it attaches the aggregate. Section 3.6.2 of the host filesystem design says so, beside the VMM's refusal of a host path of the other kind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/design/3.6-host-filesystem.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/design/3.6-host-filesystem.md b/doc/design/3.6-host-filesystem.md index 3caa39802..c7db2a908 100644 --- a/doc/design/3.6-host-filesystem.md +++ b/doc/design/3.6-host-filesystem.md @@ -104,7 +104,9 @@ describes. An aggregate's root lists its children in declaration order and refuses every change with `EROFS`. A child is a host directory or a single regular file. The declared kind, not the host object, decides which, and the VMM refuses a host -path of the other kind. A file child serves only its file, as the child +path of the other kind. It also refuses a file whose name contains `\` or `:`, +which the server refuses in every path of an export, so the guest could never +reach it. A file child serves only its file, as the child itself: its volume is the file's parent directory, narrowed to the file's name, which the guest never reaches, so the guest cannot list or change anything beside the file, a lookup below it fails with `ENOTDIR`, and every From cd45f15f9823973c979a02d92b8d3b2db20ad494 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 21 Nov 2026 14:57:57 -0800 Subject: [PATCH 3/4] filesystem: refuse a file child whose name has a colon or a backslash The planner exports a mapped file outside the mapped directories as a file child of OpenVMM's aggregate, which reaches the file by its name. OpenVMM refuses a colon or a backslash in every path of a share, so a file child whose name has one, as on Windows a path that names an alternate data stream, could never be reached: the guest's bind of the child failed with EINVAL, and the pinned OpenVMM now refuses the child when the VM starts (#1614). The planner, which refuses what OpenVMM would refuse, so that such a policy fails when it is planned rather than at every start, accepted it, and so did ExportPlan::check, through which the CLI reads back the plan that a managed sandbox recorded. limits::file_name_problem now explains why OpenVMM cannot export such a file. plan refuses each child that exports one, and ExportPlan::check each file child of a plan, with an error of kind Unsupported that names the file. A file in a directory whose name has a colon is still exported, since OpenVMM opens a child's directory by its host path. files_named_with_colons_or_backslashes_are_not_exported_alone plans files named `colon:here.txt` and `back\slash.txt` on Linux, and the alternate data stream `config.json:stream` on Windows, which the planner refuses; checks a recorded plan whose file child has such a name, which the check refuses; and, on Linux, plans a file in the directory `colon:dir`, which the planner exports. Without the planner's refusal, the planner exports the stream on Windows, and without the check's, the recorded plan passes; with both, the test and the module's other tests pass on Windows and on Linux (Azure Linux 3.0, nvx-kvm-test). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/run.md | 6 +++- nvx/src/host/filesystem/limits.rs | 9 +++++ nvx/src/host/filesystem/mod.rs | 13 +++++-- nvx/src/host/filesystem/tests.rs | 58 +++++++++++++++++++++++++++++++ nvx/src/host/filesystem/verify.rs | 15 ++++++-- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/doc/run.md b/doc/run.md index d0626d68c..1fb89f998 100644 --- a/doc/run.md +++ b/doc/run.md @@ -890,7 +890,11 @@ children are the outermost mapped directories and the mapped files outside them, so a `--mount` of a directory again, or of a path inside a mapped directory, maps a part of that directory's child rather than a child of its own. OpenVMM's `file` flag marks a child that is a shared file, so OpenVMM -refuses a directory that replaced the file rather than export all of it. A +refuses a directory that replaced the file rather than export all of it. +OpenVMM refuses a colon or a backslash in every path of a share, and so a +file child whose name contains one, such as a Windows path that names an +alternate data stream, which the guest could never reach; NVX rejects such a +file child before boot. A child is read-write only if it holds a read-write mapping, and OpenVMM then limits its writes to its read-write mappings, which NVX passes as `--mount-write` paths when they lie inside a read-only one. A read-only diff --git a/nvx/src/host/filesystem/limits.rs b/nvx/src/host/filesystem/limits.rs index b7282e3dd..1dfa5344d 100644 --- a/nvx/src/host/filesystem/limits.rs +++ b/nvx/src/host/filesystem/limits.rs @@ -39,6 +39,15 @@ pub(super) fn check_root(root: &Path) -> Result<()> { Ok(()) } +/// Explains why OpenVMM cannot export the file `file` alone, as a child, or returns `None` if it +/// can. OpenVMM reaches the file by its name, in which it refuses a colon or a backslash, as in +/// every path of an export, such as a Windows path that names an alternate data stream of a file. +pub(super) fn file_name_problem(file: &Path) -> Option<&'static str> { + file.file_name() + .is_some_and(|name| name.to_string_lossy().contains([':', '\\'])) + .then_some("has a colon or a backslash in its name") +} + /// Applies OpenVMM's rules for the paths that it is to `action` in the exported directory `root`, /// so a policy that OpenVMM would refuse fails at provision rather than at every start: those of /// [`policy_limits`], and on the host, no link or reparse point below `root` and no other file diff --git a/nvx/src/host/filesystem/mod.rs b/nvx/src/host/filesystem/mod.rs index 25be78427..a620f059a 100644 --- a/nvx/src/host/filesystem/mod.rs +++ b/nvx/src/host/filesystem/mod.rs @@ -87,7 +87,7 @@ pub(crate) use self::host_path::{canonicalize, is_reparse_point}; #[cfg(feature = "cli")] use self::host_path::{identity, relative_text}; #[cfg(feature = "cli")] -use self::limits::{check_policy_paths, check_root}; +use self::limits::{check_policy_paths, check_root, file_name_problem}; #[cfg(feature = "cli")] use self::policy::{ Writable, allowed_paths, canonicals, check_allowed_paths, check_read_only, check_write_paths, @@ -360,7 +360,8 @@ pub(crate) struct ExportRequest<'a> { /// target is mapped once, read-only if either mapping is. Two objects never share a target, and a /// target inside another mapping's must show the very object that the other mapping shows there. /// A whole volume cannot be mapped, and a policy that would need more children than OpenVMM -/// offers is refused. +/// offers is refused. A file that a child exports alone must not have a colon or a backslash in +/// its name, which OpenVMM refuses in every path of an export. /// /// A read-only path must not lie inside a writable part, where the host could not keep it /// read-only: inside a read-write directory, unless write paths narrow that directory's writes @@ -496,6 +497,14 @@ pub(crate) fn plan(request: &ExportRequest<'_>) -> Result> let child_allowed = inside(&allowed); let child_denied = needed_denied_paths(&inside(&denied), &child_allowed); check_root(root)?; + if !own.directory + && let Some(problem) = file_name_problem(root) + { + return unsupported(format!( + "OpenVMM cannot export {}, which {problem}", + root.display() + )); + } policy_bytes += check_policy_paths(root, &child_denied, "hide")?; policy_bytes += check_policy_paths(root, &child_allowed, "show again")?; policy_bytes += check_policy_paths(root, &part.write, "make writable")?; diff --git a/nvx/src/host/filesystem/tests.rs b/nvx/src/host/filesystem/tests.rs index 7842fdc62..22b3dedd3 100644 --- a/nvx/src/host/filesystem/tests.rs +++ b/nvx/src/host/filesystem/tests.rs @@ -889,6 +889,64 @@ fn policy_paths_follow_openvmm_rules() { } } +/// OpenVMM reaches a file that a child exports alone by its name, and refuses a colon or a +/// backslash in every path of an export, so the planner refuses such a file, and a recorded plan +/// that exports one fails its check, but not a file in a directory with such a name, which OpenVMM +/// opens by its host path. +#[cfg(feature = "cli")] +#[test] +fn files_named_with_colons_or_backslashes_are_not_exported_alone() { + let directory = root(); + let base = directory.path(); + let names: &[&str] = if cfg!(windows) { + // A Windows path with a colon in its last name names an alternate data stream. + &["config.json:stream"] + } else { + &["colon:here.txt", "back\\slash.txt"] + }; + let refused = |error: Error| { + assert_eq!(error.kind(), ErrorKind::Unsupported, "{error}"); + assert!( + error.message().contains("a colon or a backslash"), + "{error}" + ); + }; + for name in names { + let file = base.join("work").join(name); + fs::write(&file, b"notes").unwrap(); + let policy = FilesystemPolicy { + readonly_paths: vec![file], + ..FilesystemPolicy::default() + }; + refused(plan(&policy).unwrap_err()); + } + // A plan recorded before the planner refused such a file is refused when it is read back. + let plain = plan(&FilesystemPolicy { + readonly_paths: vec![base.join("work").join("config.json")], + ..FilesystemPolicy::default() + }) + .unwrap() + .unwrap(); + plain.check(ReservedTargets::BLOCKLESS_ROOT).unwrap(); + for name in names { + let mut recorded = plain.clone(); + recorded.children[0].root.set_file_name(name); + refused(recorded.check(ReservedTargets::BLOCKLESS_ROOT).unwrap_err()); + } + if !cfg!(windows) { + let file = base.join("colon:dir").join("notes.txt"); + fs::create_dir(file.parent().unwrap()).unwrap(); + fs::write(&file, b"notes").unwrap(); + let policy = FilesystemPolicy { + readonly_paths: vec![file.clone()], + ..FilesystemPolicy::default() + }; + let mapping = plan(&policy).unwrap().unwrap(); + assert_eq!(mapping.children[0].root, canonical(&file)); + assert!(mapping.children[0].file); + } +} + #[cfg(feature = "cli")] #[test] fn openvmm_limits_are_checked_per_directory() { diff --git a/nvx/src/host/filesystem/verify.rs b/nvx/src/host/filesystem/verify.rs index 935f0ea93..d8702e7a7 100644 --- a/nvx/src/host/filesystem/verify.rs +++ b/nvx/src/host/filesystem/verify.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use super::guest_path::depth; use super::host_path::{display_path, relative_text}; -use super::limits::policy_limits; +use super::limits::{file_name_problem, policy_limits}; #[cfg(feature = "cli")] use super::policy::Writable; use super::policy::{nearest_rule, policy_rule_problem}; @@ -30,8 +30,9 @@ impl ExportPlan { /// root that reserves `reserved`: at least one and at most [`MAX_CHILDREN`] children, none /// inside another, each an absolute host path below a volume's root, with its host paths /// resolved, without a NUL character or a `..` component, and, on Windows, on a local drive, - /// without the verbatim prefix, whose policy paths lie inside it within OpenVMM's limits and - /// keep its rules, and writable exactly when a bind maps a path of it read-write; and at least + /// without the verbatim prefix, each file without a colon or a backslash in its name, whose + /// policy paths lie inside it within OpenVMM's limits and keep its rules, and writable exactly + /// when a bind maps a path of it read-write; and at least /// one and at most [`MAX_HOST_MAPPINGS`] binds, each of a known child, from a relative source /// that holds the host's names joined with `/`, that a guest path can hold, and that the child /// does not hide, unless it shows paths inside it again, to a free guest target, parents before @@ -80,6 +81,14 @@ impl ExportPlan { "child {index} has the host path {path:?}, which {problem}" )); } + if child.file + && let Some(problem) = file_name_problem(&child.root) + { + return invalid(format!( + "child {index}, {}, is a file that {problem}, which OpenVMM cannot export", + child.root.display() + )); + } if let Some(path) = [&child.denied, &child.allowed, &child.write] .into_iter() .flatten() From 8fc7a8d286e94249ba9520de7a6351127d05e68b Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Sat, 21 Nov 2026 16:49:51 -0800 Subject: [PATCH 4/4] doc: map the refusal of microVM file children in the OpenVMM roadmap Map position 343, the commit of microsoft/openvmm#5209, which NVX now pins at afa0e9c20, 217 commits past the mapped tip: - 343, virtiofs: refuse a microVM file child that its volume cannot name. open_microvm_volume refuses the file of an aggregate's file child whose name holds `\` or `:`, which the strict volume that it opens on the file's directory refuses in every path, so attaching the aggregate fails with an error that names the file. Such a child attached, but every guest LOOKUP of it failed with EINVAL. Position 343 is not yet assigned to a PR. It fixes a defect of position 165, which adds file children and which no PR maps, using the strict path check of PR18's position 081, and changes open_microvm_volume, which position 164 adds and position 165 extends to files; it changes nothing else that a mapped PR adds. Upstream main, bf353460f, lacks the defect, since it lacks the microVM profile, and replaying the commit there conflicts in all three files that it changes, which upstream main lacks, so it cannot go upstream on its own and follows position 165. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/openvmm-upstream-roadmap.md | 49 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/doc/openvmm-upstream-roadmap.md b/doc/openvmm-upstream-roadmap.md index ce9b24260..a900ae727 100644 --- a/doc/openvmm-upstream-roadmap.md +++ b/doc/openvmm-upstream-roadmap.md @@ -9,8 +9,9 @@ - Mapped fork tip: `1e492803287f04b40bb7c17e8648c4b96af52ecc`, position 126. The graph, PR summary, and commit mapping below cover positions 001-126, the PR18 fixups at positions 302, 333, and 342, and the PR13 fixup at position 340. -- NVX's pinned OpenVMM revision: `5c82edac42ca480d546459e019860759a27c2211`, position 342, the head - of microsoft/openvmm#5208, whose commit follows position 341, `ed2d7e3a1`, the head of +- NVX's pinned OpenVMM revision: `afa0e9c20a7943d3ec556098d9272f4ee502bdd4`, position 343, the head + of microsoft/openvmm#5209, whose commit follows position 342, `5c82edac4`, the head of + microsoft/openvmm#5208, whose commit follows position 341, `ed2d7e3a1`, the head of `feature/microvm/dev`, where microsoft/openvmm#5207 landed position 341 on position 340, `32888344a`, where microsoft/openvmm#5206 landed position 340 on position 339, `b51f9156c`, the head of the `feature/microvm/release/v7.2` branch of microsoft/openvmm. The @@ -19,9 +20,9 @@ landed, so each later commit's position is one less than before, and it added five fixups at its tip, positions 335-339. Of the 334 replayed commits, 47 conflicted with upstream and 13 replayed with new context; see [Conflicts of the v7.2 rebase](#conflicts-of-the-v72-rebase). The pin is - 216 commits past the mapped tip on the same first-parent chain. Positions 127-301, 303-332, 334, - and 341 are not yet assigned to PRs, positions 302, 333, and 342 are PR18 fixups, position 340 - is a PR13 fixup, and positions 316 and 335-339 are rebase fixups; see + 217 commits past the mapped tip on the same first-parent chain. Positions 127-301, 303-332, 334, + 341, and 343 are not yet assigned to PRs, positions 302, 333, and 342 are PR18 fixups, position + 340 is a PR13 fixup, and positions 316 and 335-339 are rebase fixups; see [Commits after the mapped tip](#commits-after-the-mapped-tip). - Upstream main: `bf353460ff70e4a65627bb7003bed2cad1ce121f` (2026-11-21), the fork base; see [Upstream main past the fork base](#upstream-main-past-the-fork-base). @@ -1619,7 +1620,8 @@ bf353460f -> PR13 fixup [340] -> virtio-fs aggregate root reads bounded at 1 MiB [341] -> PR18 fixup [342] - -> 5c82edac4 (NVX pin) + -> microVM file children whose names hold `\` or `:` refused [343] + -> afa0e9c20 (NVX pin) ``` For upstream review, PR01-PR03, PR05, PR06, and PR14 can be rebased independently onto current @@ -1658,7 +1660,7 @@ the policy tests share the `request` helper that the tests call. ## Commits after the mapped tip -The NVX pin extends the chain past position 126 without merges. Of its 216 later commits, positions +The NVX pin extends the chain past position 126 without merges. Of its 217 later commits, positions 302, 333, and 342 are PR18 fixups, position 340 is a PR13 fixup, position 316 is the fixup of the v7.1 rebase, positions 335-339 are the fixups of the v7.2 rebase, and the others are not yet classified or assigned to PRs. @@ -1669,7 +1671,7 @@ of the v4.0 reorganization, positions 201-206 followed it, positions 207-213 fol reorganization, positions 214 and 215 followed the v5.1 rebase, positions 216-253 followed the v6.0 reorganization, positions 254-296 followed the v6.1 rebase, positions 297-315 followed the v7.0 reorganization, position 316 is the v7.1 rebase's fixup, positions 317-334 followed the -v7.1 rebase, positions 335-339 are the v7.2 rebase's fixups, and positions 340-342 followed the +v7.1 rebase, positions 335-339 are the v7.2 rebase's fixups, and positions 340-343 followed the v7.2 rebase, so they combine none, apart from position 215, which combines v5.1 positions 222 and 223, and the commits that the v7.0 reorganization folded into them. Each commit through position 316 has the position that it had in @@ -1677,7 +1679,7 @@ v7.0 and v7.1, and each of positions 317-334 is its v7.1 position less one, sinc dropped v7.1 position 317, upstream's microsoft/openvmm#5160, which v7.1 had backported. Each commit's v6.1 position is its v6.0 position less seven, the number of commits that the v6.1 rebase dropped before it, and its v6.0 position is its v5.1 position through 147 and one less from v5.1 -position 149 on, and positions 297-342 have no earlier position; see +position 149 on, and positions 297-343 have no earlier position; see [Conflicts of the v7.2 rebase](#conflicts-of-the-v72-rebase), [The v7.0 reorganization](#the-v70-reorganization), [Conflicts of the v6.1 rebase](#conflicts-of-the-v61-rebase), and @@ -1906,6 +1908,7 @@ whose first 220 commits are those of `feature/microvm/release/v6.0`, and a v4.0 | 340 | `32888344a` | - | - | - | - | - | - | virtiofs: keep node names when renaming a name onto itself (microsoft/openvmm#5206); fold into 048, its test into 166 | | 341 | `ed2d7e3a1` | - | - | - | - | - | - | virtiofs: bound the buffer of an aggregate root's directory read (microsoft/openvmm#5207) | | 342 | `5c82edac4` | - | - | - | - | - | - | virtiofs: bound microVM directory snapshots in total when listing (microsoft/openvmm#5208); fold into 083, its budget in `new_microvm_aggregate` and its tests into 164 | +| 343 | `afa0e9c20` | - | - | - | - | - | - | virtiofs: refuse a microVM file child that its volume cannot name (microsoft/openvmm#5209) | The remarks that say whether commits apply to upstream main record what was found on upstream main when each commit was mapped: the v3.0 reorganization's base, `b2676222b`, for the commits that it @@ -1916,7 +1919,7 @@ and `c0694c4da`, upstream main on 2026-11-16, for positions 297-306, `c4419be15` main on 2026-11-19, for positions 321-324, `78af54a51`, upstream main on 2026-11-20, for position 325, `d83f87209`, upstream main later that day, for position 326, `265f0a73f`, upstream main later still, for positions 327 and 328, and `bf353460f`, upstream main on 2026-11-21 and the v7.2 -fork base, for positions 329-334 and 340-342. +fork base, for positions 329-334 and 340-343. They name the positions that the commits have now, but neither the v7.2 rebase on `bf353460f`, the v7.1 rebase on `9a875b563`, nor the v7.0 reorganization on `e6b458cc0` checked them again, nor did the v6.1 rebase check the earlier ones on `7d90c4104`. @@ -4374,6 +4377,32 @@ since it lacks the microVM persistence. Replaying the commit there conflicts in `lib.rs`, next to the code of positions 081, 083, and 158, and in the microVM's `file.rs`, `fs.rs`, and `fs_tests.rs`, which upstream main lacks, so it follows PR18 upstream. +Position 343 has `open_microvm_volume` refuse the file of an aggregate's file child whose name holds +`\` or `:`, so that attaching the aggregate fails, at a cold boot or a restore, with an error that +names the file (microsoft/nvx#1614). Position 165 opens the file's host directory as a strict +volume whose root object is the file, at its name, and PR18's position 081 has a strict volume +refuse every path with `\` or `:`, in `validate_relative_path`, which the preflight of an insert +that position 081 adds, the confinement check that PR27's position 126 adds, and the save and +restore of PR18's position 083 apply to every name of a node. Nothing checked the file's name +when the child attached, since the profile's path rules cover only the policy paths that it +parses, so a file child whose name had one, common on Linux, as in timestamps or digests, and on +Windows the name of an alternate data stream of a file, attached, but every guest `LOOKUP` of it +failed with `EINVAL`, and so did a `READDIRPLUS` of the aggregate's root from the child on, while +a plain `READDIR` listed it as a regular file. The commit applies the same `validate_relative_path` +to the file's name; a directory's own name is never a path of its volume, so directory shares and +children are unchanged, and the saved state keeps its format. It changes the file branch of +`open_microvm_volume` in the microVM's `fs.rs`, which position 164 adds and position 165 extends +to files, and the rustdoc of `new_microvm_aggregate`, which position 164 adds and position 165 +changes; PR18's positions 081, 083, and 085, PR22's position 102, PR27's position 126, and +positions 158, 160, 194, 332, and 342 also change the file. It adds tests to the microVM's +aggregate tests, which position 164 adds and positions 165, 194, and 341 also change, and a bullet +to the "Single files" part of the Guide's virtio-fs page, which position 165 adds. It fixes a +defect of position 165, which no PR maps, so it is not yet assigned to a PR either and follows +position 165. Upstream main lacks the defect, since it lacks the microVM profile and its file +children. Replaying the commit there conflicts in all three files, which upstream main lacks: the +microVM's `fs.rs` and `aggregate_fs_tests.rs` and the Guide's virtio-fs page, so it cannot go +upstream on its own. + ## PR summary Each count is of v7.2 commits, which include the fixups that the v3.0, v4.0, v5.0, v6.0, and v7.0