Repository navigation
Description
Summary
In microVM mode, VirtioFsFile::read_dir_microvm compares the st_ino returned by lookup_helper (fuse_entry.attr.ino) against the directory snapshot's d_ino-derived entry.guest_inode_id and returns Err(lx::Error::EIO) whenever they differ. On btrfs, directory entries for child subvolume roots and for nested-subvolume placeholders inside snapshots permanently carry a parent-tree d_ino that differs from lstat's st_ino (256 for a subvolume root, 2 for an empty placeholder), causing FUSE_READDIRPLUS to fail with EIO on any directory containing a btrfs subvolume or snapshot placeholder. Found by testing.
Root Cause
When opening and first enumerating a directory in microVM mode, VirtioFsFile::build_microvm_directory_snapshot populates entry.guest_inode_id from getdents64's d_ino (self.inode.guest_ino(entry.inode_nr)). During FUSE_READDIRPLUS, VirtioFsFile::read_dir_microvm resolves the child via fs.lookup_helper(&self.inode, name) (which runs lstat on the child path) and rejects any mismatch between fuse_entry.attr.ino and entry.guest_inode_id with EIO:
let fuse_entry = fs.lookup_helper(&self.inode, name)?;
if fuse_entry.attr.ino != entry.guest_inode_id {
return Err(lx::Error::EIO);
}
if !buffer.dir_entry_plus(name, entry.next_cookie, fuse_entry) {
return Err(lx::Error::EIO);
}On btrfs, a child subvolume entry in its parent directory's B-tree carries a ROOT_ITEM reference object ID as d_ino (for example 257 or 388), whereas lstat on the child path crosses into the child subvolume's fs-tree and reports st_ino = 256 (BTRFS_FIRST_FREE_OBJECTID). Likewise, when snapshotting a subvolume that contains a nested subvolume, btrfs materializes an empty directory placeholder inside the snapshot whose parent d_ino is the nested subvolume's object ID while lstat reports st_ino = 2 (BTRFS_EMPTY_SUBVOL_DIR_OBJECTID). Plain FUSE_READDIR and non-microVM FUSE_READDIRPLUS both succeed on these directories, whereas microVM FUSE_READDIRPLUS always hits fuse_entry.attr.ino != entry.guest_inode_id.
Consequence
Because the microVM profile negotiates FUSE_DO_READDIRPLUS and FUSE_READDIRPLUS_AUTO by default, standard guest directory listings (ls, find, stat-walking tools, language runtimes, and container rootfs walks) issue FUSE_READDIRPLUS. Any shared host directory on btrfs that contains a subvolume root (such as default Fedora/SUSE layouts, container/image storage, or btrfs-backed workspaces) or a snapshot containing a nested subvolume placeholder fails FUSE_READDIRPLUS with EIO (Input/output error), making the entire parent directory unlistable in the guest while leaking the lookup reference acquired by lookup_helper on that entry and any earlier entries in the aborted batch.
Reproduction
- On a Linux btrfs filesystem supporting unprivileged subvolumes, create a host directory
rootand runbtrfs subvolume create root/sub(or snapshot a subvolume containing a nested subvolumesub/innertoroot/snap). - Construct a microVM
VirtioFsshare rooted atroot, open the root directory (FUSE_OPENDIR), and issueFUSE_READDIRPLUSatoffset = 0. - Observe
Fuse::read_dir_plusfail withErr(lx::Error::EIO)as soon as it reaches"sub"(or"inner"inside"snap"), whereasFuse::lookupon the same name succeeds.
Activity
tangruize commentedon Nov 15, 2026
Suggested Fix
Remove the
if fuse_entry.attr.ino != entry.guest_inode_id { return Err(lx::Error::EIO); }check inVirtioFsFile::read_dir_microvm.fs.lookup_helper(&self.inode, name)already enforces path confinement and subtree access policy on the current child path, andbuffer.dir_entry_plusencodesfuse_entry(includingfuse_entry.attr.ino, which overridesdirent.inoforREADDIRPLUSconsumers) directly into the reply. Entries replaced between directory pages will likewise be listed with their current node and attributes rather than aborting the listing withEIO. When merging alongside the siblingread_dir_microvmchanges for mid-listing lookup-reference rollback and open-directory self-aliasing, keep thenode_id == dir_node_id || !buffer.dir_entry_plus(...)rollback guard without reintroducingfuse_entry.attr.ino != entry.guest_inode_id.Patch against OpenVMM
9d64daad3cbe14fb0591081b73c6c9648e18d0fb. Save the contents below asfix.patchand rungit apply fix.patch.fix.patch