You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: virtiofs: FUSE_FSYNCDIR on aggregate synthetic root handle fails with EBADF #1624
On an aggregate virtiofs mount (microVM or direct aggregate), FUSE_OPENDIR on FUSE_ROOT_ID (1) returns the sentinel handle SYNTHETIC_ROOT_FH (u64::MAX) without inserting an entry into self.inner.files. While get_attr, get_statx, read_dir, read_dir_plus, and release_dir all recognize SYNTHETIC_ROOT_FH, VirtioFs::fsync_dir ignores request and looks up fh directly in self.get_file(fh), causing FUSE_FSYNCDIR (fsync() / fdatasync() on an open directory descriptor for the aggregate mount point) to fail with EBADF. Found by testing.
Because SYNTHETIC_ROOT_FH is never inserted into self.inner.files, self.get_file(fh) logs "Request for unknown file" and returns Err(lx::Error::EBADF).
Consequence
When guest software opens an aggregate mount-point directory (open("/mnt", O_RDONLY | O_DIRECTORY)) and invokes fsync(fd) or fdatasync(fd) (as archive extractors, package managers, backup tools, and atomic file-replacement helpers routinely do on parent/mount directories), the Linux FUSE client sends FUSE_FSYNCDIR with the handle returned by FUSE_OPENDIR and receives EBADF despite holding a valid open directory descriptor.
Reproduction
Construct an aggregate VirtioFs via VirtioFs::new_microvm_aggregate (or VirtioFs::new_aggregate).
Call Fuse::open_dir(&fs, &request(FUSE_ROOT_ID), lx::O_RDONLY as u32) to obtain fh (SYNTHETIC_ROOT_FH).
In VirtioFs::fsync_dir, inspect request.node_id() and return Ok(()) immediately when self.is_synthetic_root_handle(request.node_id(), fh) holds (matching VirtioFs::release_dir), since the synthetic aggregate root is a read-only in-memory directory with no host backing descriptor to synchronize.
Activity
tangruize commentedon Nov 15, 2026
Suggested Fix
In
VirtioFs::fsync_dir, inspectrequest.node_id()and returnOk(())immediately whenself.is_synthetic_root_handle(request.node_id(), fh)holds (matchingVirtioFs::release_dir), since the synthetic aggregate root is a read-only in-memory directory with no host backing descriptor to synchronize.Patch against OpenVMM
9d64daad3cbe14fb0591081b73c6c9648e18d0fb. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch