Skip to content

openvmm: refuse microVM file children whose names hold a colon or a backslash - #1936

Merged
Pedro Henrique Penna (ppenna) merged 4 commits into
devfrom
agents/issue-1614-aggregate-child-names
Nov 22, 2026
Merged

Pedro Henrique Penna (ppenna) merged 4 commits into
devfrom
agents/issue-1614-aggregate-child-names

Conversation

@ppenna

@ppenna Pedro Henrique Penna (ppenna) commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1614

What does this pull request change?

It pins microsoft/openvmm#5209, which makes OpenVMM refuse a microVM aggregate's file child whose host file's name holds a backslash or a colon, and it makes NVX's export planner refuse such a file child before boot:

  • Before: OpenVMM opens a file child's host directory as a strict volume whose root object is the file, at its name, and a strict volume refuses \ and : in every path. Nothing checked the file's name when the child attached, so a file child whose name had one, as in a timestamp, a device identifier, or a digest on Linux, or a Windows path that names an alternate data stream (settings.json:stream, settings.json::$DATA), attached without an error, but the guest could never reach it: every 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. NVX's planner, which exports a mapped file outside the mapped directories as such a child, accepted it, so nvx run or a sandbox's start booted a guest whose bind of the child then failed.
  • After: OpenVMM fails to attach the aggregate, at a cold boot or a restore, with microVM virtio-fs file <path> has a name with `\` or `:`, which no microVM path may contain. NVX's planner refuses such a file child when it plans the export, with an Unsupported error that names the file, and ExportPlan::check refuses a recorded plan that exports one, such as that of a sandbox provisioned before this change, before start launches OpenVMM. A directory's own name is never a path of its volume, so directory shares and children are unchanged, as is a file in a directory whose name has a colon.

Commits:

  1. openvmm: pin the refusal of microVM file children that it cannot name moves the gitlink only, from 5c82edac4 to afa0e9c20. The protocol vectors and CPU profiles that nvx copies are unchanged.
  2. doc: say that the VMM refuses a file child with a backslash or colon adds the refusal to section 3.6.2 of 3.6 Host Filesystem.
  3. filesystem: refuse a file child whose name has a colon or a backslash adds limits::file_name_problem, which plan applies to each child that exports a file and ExportPlan::check to each file child of a plan, a test, and a sentence to virtio-fs host mapping.
  4. doc: map the refusal of microVM file children in the OpenVMM roadmap maps position 343, which is not yet assigned to a PR.

Start with open_microvm_volume in microsoft/openvmm#5209's vm/devices/virtio/virtiofs/src/microvm/fs.rs, then file_name_problem in nvx/src/host/filesystem/limits.rs and its callers in mod.rs and verify.rs.

Left out, and found while fixing this:

  • A mapped file inside a mapped directory is part of that directory's child, so NVX still plans one whose name holds a colon or a backslash, and the guest's bind of it fails with EINVAL, since OpenVMM refuses such a name in every path of a share.
  • From reading the code, listing a microVM shared directory that holds a host entry with such a name looks like it fails with EINVAL as a whole, rather than leaving the entry out; this is not verified by a test.

Both concern names inside directory children and predate this change.

Why is this change needed?

A host program that shares a single file whose name holds a colon, common in timestamps, PCI or device identifiers, OCI digests, and systemd-style names, got a VM whose share was listed but unreachable, and on Windows a path that names an alternate data stream attached a child that no request could use. The root cause is microsoft/openvmm d26ae8bd5, "microVM: export single host files as aggregate virtio-fs children", roadmap position 165, which added file children and the file branch of open_microvm_volume without applying to the file's name the strict path rule that PR18's position 081, 4354bcc9e, applies to every name of a node, in its insert preflight, and that the confinement check and the microVM save and restore apply too.

Kept from the issue's suggested fix: refusing the file at attachment, in open_microvm_volume. Changed: the issue's patch checked the name's bytes for \ and : itself, while the fix applies the volume's own validate_relative_path, so the rule at attachment cannot drift from the one that every later request applies, and its regression tests are unit tests in the crate, including Windows' alternate data streams, rather than a new integration test.

Alternatives rejected:

  • Exempting the file's name from the strict path rule, so that such a child works: the name is the node's alias, which a microVM save records and a restore validates as a strict path, so accepting it would change what a snapshot may hold, and on Windows such a name addresses an alternate data stream, which the strict paths keep out.
  • Exporting the file's directory instead: it grants more than the file, and the guest still could not reach the file by its name inside it.
  • Checking only in NVX: OpenVMM's other callers, its CLI and its management RPC, would still attach unreachable children. NVX checks too because its planner refuses what OpenVMM would refuse, so that a sandbox's policy fails when it is planned rather than at every start.

How was this change validated?

Checks and results:

Check Result
cargo nextest run --profile agent -p virtiofs, OpenVMM at the pin, Windows 11 191 passed, 1 skipped
The same on nvx-kvm-test, Azure Linux 3.0 VM 197 passed, 1 skipped
a_file_child_with_a_backslash_or_colon_in_its_name_is_refused with the fix reverted, at the pin's parent 5c82edac4 and at b51f9156c, Windows and Linux fails: file:stream (Windows) and : (Linux) attach; at b51f9156c, the guest's LOOKUP of such a child fails with EINVAL on both hosts, and on Linux a READDIRPLUS of the root stops before it
cargo check, cargo clippy --all-targets, cargo doc --no-deps -p virtiofs, Windows and Linux clean
cargo xtask fmt --fix (OpenVMM) no changes
cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_vectors -- --ignored 4 passed
cargo test --locked --manifest-path nvx/Cargo.toml --no-default-features --test openvmm_cpu_profiles -- --ignored 1 passed
The commands of .github/actions/check-nvx/action.yml on Windows 11: cargo fmt --all --check, the six cargo clippy ... -- -D warnings runs, cargo test --locked --all-features, cargo test --locked, cargo build and cargo test --locked --lib --no-default-features, cargo doc --locked --no-deps --all-features with RUSTDOCFLAGS=-D warnings, the 1.89 MSRV cargo check, the aarch64-apple-darwin cargo check, and python scripts\public_api.py all pass: 1287, 598, and 196 tests passed, none failed; the public API is unchanged
The Linux-only steps of that action on nvx-kvm-test: python3 scripts/nvx.py check-guest-binaries, build-guest-binaries, and test-guest-binaries pass
files_named_with_colons_or_backslashes_are_not_exported_alone, with the planner's refusal or the check's removed, Windows fails: the planner exports config.json:stream, and the recorded plan passes check
The host::filesystem tests with both, Windows and Linux; cargo clippy with -D warnings on Linux 36 and 34 passed; clean
python scripts\openvmm_pin.py check-branch --topic --target origin/agents/issue-1613-snapshot-bounds passed
python scripts\openvmm_pin.py check-roadmap --worktree passed
python scripts\check_markdown_links.py, python scripts\check_test_layout.py passed
python scripts\check_test_changes.py --base origin/agents/issue-1613-snapshot-bounds 0 changes to existing tests, 1 added
python scripts\nvx.py verify passed
python scripts\local_gates.py --base origin/agents/issue-1613-snapshot-bounds --only nvx-cli --run passed: 2,314 and 84 script tests ran, none failed

Backend, host OS, host type, and guest:

KVM on nvx-kvm-test, an Azure Linux 3.0 virtual machine (kernel 6.18), with the Alpine guest and the default kernel. OpenVMM was built at the pin by python3 scripts/nvx.py build-openvmm --backend kvm (provenance afa0e9c20, clean). The other artifacts came from the v0.1.0-dev.3e98eff40820 release, installed by nvx download --hypervisor kvm. The NVX revision was f1625dbf, whose tree differs from this head only in the recorded-plan check of ExportPlan::check and its test, which no scenario reaches. python3 scripts/nvx.py test-microvm --backend kvm passed for platform-filesystem, filesystem-snapshot, filesystem-shares, filesystem-policy, denied-filesystem-paths, platform-aggregate-export, and filesystem-comma-paths, which attach file children and directory children, capture and restore them, and share paths with commas.

Left to CI, which passed for this head in run 44971224562: the rest of the microVM matrix on KVM, MSHV, and WHP, the guest builds, the benchmarks, and openvmm-ci. OpenVMM's CI of the pin, run 44968497410, passed every job that openvmm-ci requires, as python scripts\nvx.py check-openvmm-ci --revision afa0e9c20a7943d3ec556098d9272f4ee502bdd4 confirms: unit tests [x64-linux], unit tests [x64-windows], and run vmm-tests of x64-linux-amd-kvm, x64-linux-intel-mshv, x64-windows-intel, and x64-windows-amd; its run vmm-tests [x64-windows-amd-snp] failed, which NVX does not require.

Checklist

  • Tests cover the new or fixed behavior, in the layout that
    python3 scripts/check_test_layout.py checks.
  • python3 scripts/check_test_changes.py --base origin/dev lists no change
    to an existing test, or a Changes to existing tests section below
    explains each one.
  • The documentation that the change affects is updated, including
    .github/copilot-instructions.md and the skills when a convention or
    workflow changes.
  • A change to the public API of nvx updates nvx-rs/public-api/ with
    python3 scripts/public_api.py --update.
  • Snapshots, protocols, and on-disk formats stay compatible, or the
    description says how the change versions or migrates them.

No version is created or bumped: no saved-state schema, ABI, machine-contract, time-ABI, manifest, or protocol version changes, and neither the device's saved state nor the recorded export plan changes. A restore of a snapshot whose aggregate exports such a file now fails when it attaches the aggregate, as a cold boot does; the child was never reachable. The public API of nvx keeps its items; ExportPlan::check now also refuses a plan that exports such a file.

OpenVMM pin

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
(#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'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>
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>
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the filesystem export filename-validation change.

No open issues 🎉

What changed in this PR

This PR addresses #1614 by aligning NVX’s filesystem export validation with OpenVMM’s rejection of standalone file children whose names contain a colon or backslash. It rejects these unreachable exports before boot, including those in previously recorded plans.

Changes:

  • Pins the OpenVMM fix that rejects unsupported file-child names at attachment.
  • Adds shared filename validation to export planning and recorded-plan checks, with regression coverage.
  • Documents the restriction and maps the OpenVMM commit in the upstream roadmap.
File Description
nvx/​src/​host/​filesystem/​verify.rs Rejects unsupported file-child names in recorded export plans.
nvx/​src/​host/​filesystem/​tests.rs Tests planner and recorded-plan rejection, plus valid filenames under colon-containing directories.
nvx/​src/​host/​filesystem/​mod.rs Rejects unsupported standalone file exports during planning.
nvx/​src/​host/​filesystem/​limits.rs Adds the shared filename validation helper.
doc/​run.md Explains the restriction and rejection before boot.
doc/​openvmm-upstream-roadmap.md Records the new pin and maps its fix at position 343.
doc/​design/​3.6-host-filesystem.md Documents OpenVMM’s file-child attachment restriction.

Review effort: Balanced

Base automatically changed from agents/issue-1613-snapshot-bounds to dev November 22, 2026 02:14
@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 22, 2026
Merged via the queue into dev with commit 66ef6a1 Nov 22, 2026
53 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the agents/issue-1614-aggregate-child-names branch November 22, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openvmm: virtiofs: microVM aggregate file child with ':' or '\' in host filename attaches successfully but fails every guest lookup with EINVAL

2 participants