Repository navigation
Description
Scope
OpenVMM-only follow-up to #1253, tracked in the NVX repository.
Implement the source changes in microsoft/openvmm on feature/microvm/dev.
This issue does not include NVX source changes or a submodule-pin update.
Problem and ownership
OpenVMM creates snapshot staging directories and the files inside them. On
Windows, its secure-creation helpers pass ordinary UTF-16 paths directly to
CreateDirectoryW and CreateFileW, without extended-length path conversion.
A staging path around 267 characters can consequently fail with:
failed to create staging directory ...\transaction\.snapshot.staging-...:
The system cannot find the path specified. (os error 3)
Changing the parent-directory creator outside OpenVMM does not fix these
independent Win32 calls. Both secure directory creation and secure file creation
must support long paths.
Source references below use the investigated OpenVMM revision
eda13d80a85e49c16ed0500a9d4ae762ca810304.
Exact production fix
Change support\pal\src\windows\security.rs, in the pal package:
source.
-
Import
std::path::Componentandstd::path::Prefix. -
Add a private
secure_create_pathhelper immediately before
create_directory_with_security. -
Replace the direct
U16CString::from_os_str(...)conversion in both
create_directory_with_securityandcreate_file_with_securitywith:let path = secure_create_path(path)?;
The proposed helper is:
fn secure_create_path(path: &Path) -> std::io::Result<U16CString> {
let path = std::path::absolute(path)?;
let name = U16CString::from_os_str(path.as_os_str())
.map_err(|error| std::io::Error::new(ErrorKind::InvalidInput, error))?;
if name.len() < 248 {
return Ok(name);
}
let (prefix, skip) = match path.components().next() {
Some(Component::Prefix(prefix)) => match prefix.kind() {
Prefix::Disk(_) => (r"\\?\", 0),
Prefix::UNC(..) => (r"\\?\UNC\", 2),
_ => ("", 0),
},
_ => ("", 0),
};
U16CString::from_vec(
prefix
.encode_utf16()
.chain(name.as_slice().iter().copied().skip(skip))
.collect::<Vec<_>>(),
)
.map_err(|error| std::io::Error::new(ErrorKind::InvalidInput, error))
}Required behavior and invariants:
- Resolve relative paths and ordinary
./..components before adding a
verbatim prefix. Usestd::path::absolute, not filesystem canonicalization:
the object being created does not exist yet. - Begin extended-length encoding at 248 UTF-16 code units, excluding the
terminating NUL. Keep the existing short-path representation below that bound. - Encode disk paths as
\\?\C:\...and UNC paths as
\\?\UNC\server\share\..., removing only the UNC path's original leading\\.
Do not double-prefix existing verbatim/device namespaces. - Preserve UTF-16 names without lossy conversion; reject embedded NUL rather
than operating on a truncated name. - Leave
SECURITY_ATTRIBUTES, the atomic protected DACL, access/sharing flags,
exclusiveCREATE_NEWbehavior, and error propagation unchanged.
Do not create an object permissively and restrict it afterwards. - Apply this conversion only to these filesystem paths, not process working
directories, named pipes, DLL names, or kernel-object names.
Existing callers: no duplicate path workaround needed
The production snapshot call chain already reaches these PAL functions:
StagingDirectory::createinopenvmm\openvmm_helpers\src\snapshot\publish.rs
creates.snapshot.staging-*throughcreate_private_directory.create_private_directoryinopenvmm\openvmm_helpers\src\snapshot\fs.rs
delegates topal::windows::security::create_directory_with_security.- The same file's
create_file
delegates tocreate_file_with_security.
Keep those production callers unchanged; fix the shared Win32 boundary once.
Regression changes
Only two OpenVMM files need edits:
| File | Change |
|---|---|
support\pal\src\windows\security.rs |
Production helper and both call sites above; add secure_creation_supports_long_paths in the existing test module; make its dacl_sddl test helper use the same path conversion so ACL queries support the long fixtures |
openvmm\openvmm_helpers\src\snapshot\publish.rs |
Add snapshots_are_published_under_long_paths in the existing test module; no production publication change |
The PAL regression should create real directories and files below a parent over
320 UTF-16 units, covering ordinary paths, child\.., already-verbatim paths,
and non-BMP leaf names. Reopen/read file contents, compare protected DACLs, and
require AlreadyExists when recreating either object. Preserve the existing
tests that ensure pre-existing objects are not modified.
The publication regression should publish a snapshot using real memory/scratch
fixture files below a long parent, read the manifest back, verify the paired
scratch digest, and ensure the parent contains only the published snapshot
directory, not leftover staging directories. This test needs no running VM.
Validation and acceptance
Run on Windows and Linux from the OpenVMM root:
cargo check -p pal -p openvmm_helpers
cargo clippy --all-targets -p pal -p openvmm_helpers
cargo doc --no-deps -p pal -p openvmm_helpers
cargo nextest run --profile agent -p pal -p openvmm_helpers
Run cargo xtask fmt --fix last before committing, inspect its resulting diff,
and follow the OpenVMM repository's commit requirements.
A local prototype of this scoped patch has already passed these package gates:
160 tests on Windows and 128 on Linux, with no skipped tests in those runs.
That is package-level evidence, not a full OpenVMM workspace or live VM result.
Live WHP/MSHV snapshot capture/clone, a live UNC share, and long-path hard-linked
RAM publication were not specifically exercised and must not be reported as
validated by these unit tests.
Land the reviewed fix on feature/microvm/dev and record the upstream PR and
immutable commit in this tracker.
Activity
[-]Track OpenVMM Windows long-path support for snapshot publication[/-][+]openvmm: support long Windows paths in secure snapshot creation[/+]ppenna commentedon Nov 5, 2026
The fix landed on
feature/microvm/devof microsoft/openvmm:pal: support long paths in secure file and directory creation), merged by fast-forwardingfeature/microvm/devfrom4713c539ac989c5760415f8441bdb85ae9be3e82to the immutable commit9cec2b89245f41f2126f9a787c5e43a0d84b7154.devpins that commit since openvmm: pin long Windows paths in secure snapshot creation #1284, merged ascc6152ca87d9ac28d61a216d73d569889010e078, which also maps it as position 214 indoc/openvmm-upstream-roadmap.md.secure_create_pathresolves the path as Win32 would and encodes it as an extended-length path from 248 UTF-16 code units, for bothcreate_directory_with_securityandcreate_file_with_security; the security attributes,CREATE_NEW, sharing, and error propagation are unchanged. Unlike the proposed helper, it also leaves NT (\??\...) and empty paths unchanged, sincestd::path::absolutewould resolve an NT path against the current drive.Validation, beyond the package gates of microsoft/openvmm#4916 on Windows and Linux and OpenVMM's checkin gates: on Windows/WHP (
nvx-whp-test, a virtual machine), a guest-requested capture below a longTEMPfailed at4713c539awithfailed to create staging directory ...: The system cannot find the path specified. (os error 3)and published at9cec2b892; thesnapshot-coreandscratch-snapshotmicroVM scenarios failed there at4713c539aand passed at9cec2b892; and NVX's default WHP microVM suite passed, 49 of 49, at #1284's head. Not exercised: a live UNC share.ppenna commentedon Nov 5, 2026
Closing as completed. Checked on 2026-11-05:
9cec2b89245f41f2126f9a787c5e43a0d84b7154is still the head offeature/microvm/dev. OpenVMM's CI passed for it on the pull request (run 41924015856) and on the push tofeature/microvm/dev(run 41949602732).create_directory_with_securityandcreate_file_with_securityencode their paths withsecure_create_path, and addssecure_creation_supports_long_pathstopalandsnapshots_are_published_under_long_pathstoopenvmm_helpers, as this issue asks, plus tests of the path encoding, of NT paths, and of publication by hard-linking the RAM file.devstill pins that commit, as it has since openvmm: pin long Windows paths in secure snapshot creation #1284, and its CI passed on openvmm: pin long Windows paths in secure snapshot creation #1284's merge,cc6152ca8(run 41951890861).Not exercised: a live UNC share.
doc: map the secure creation of long Windows paths in the OpenVMM roa…
pal: support long paths in secure file and directory creation