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
Commit 1495ac8
Browse filesBrowse the repository at this point in the historyBrowse files
virtiofs: record the host open flags of a microVM create handle
A microVM snapshot that held a handle that FUSE_CREATE returned could
fail to restore (microsoft/nvx#2129): the save succeeded, but the
restore refused the handle with "saved handle has unsupported open
flags".
FUSE_OPEN records the options that util::open_flags derives from the
guest's flags, without __FMODE_EXEC, O_LARGEFILE, and O_NOFOLLOW,
which only the guest uses. FUSE_CREATE opened the file with the
options that util::create_flags derives in the same way, but recorded
the guest's flags as they came. A save stores the recorded flags, and
a restore checks them with reopen_flags, which refuses __FMODE_EXEC
and spells O_LARGEFILE as x86's 0x8000. On an x86-64 host, a create
handle whose flags held __FMODE_EXEC, which only a guest that drives
the queue itself sends with FUSE_CREATE, thus could not restore, and
on an AArch64 host, where O_LARGEFILE is 0x20000 and 0x8000 is
O_NOFOLLOW, no create handle of a 64-bit Linux guest could, since its
kernel adds O_LARGEFILE to every open. Both date from 6315c16
(virtiofs: persist microVM FUSE namespaces, handles, and directory
cookies).
create now records the options, as open does, so a save stores no
guest-only flag, and VirtioFsFile says that the flags that it records
are such options. reopen_flags accepts lx::O_LARGEFILE, the host
architecture's value, in place of x86's, because a snapshot from a
release that recorded the guest's flags holds O_LARGEFILE in each of
its create handles; the restore drops it, as it drops O_NOFOLLOW. A
create handle of such a snapshot that holds __FMODE_EXEC still fails
to restore. No saved-state format or version changes.
a_create_handle_saves_and_restores_without_guest_only_flags, in the
microVM's persistence tests, creates a file on a read-write share with
O_RDWR | O_CREAT and the three guest-only flags, saves, restores,
checks that the handle saved O_RDWR | O_CREAT, and writes and reads
the file through the restored handle; then again with the saved
handle holding O_LARGEFILE and O_NOFOLLOW too, as such a release saved
it. Without the fix, at 4aeb405 as at feature/microvm/dev 1633b37,
the restore fails on Windows 11 and on Linux (x86-64) with "saved
handle has unsupported open flags 0x28062". With the fix, the test and
the package's other tests pass on both. The second case fails without
the change to reopen_flags only where O_LARGEFILE is not 0x8000, as on
AArch64, which no host here runs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments