[Virtio-fs] [virtiofsd] Issue opened: xfs test generic/375 fails when using file handles

virtiofs-bot at sinrega.org virtiofs-bot at sinrega.org
Tue Sep 6 15:33:06 UTC 2022


The XFS test generic/375 only fails when using file handles. To reproduce the error just run (in the guest):

```
# mount -t virtiofs myfs /mnt
# cd /mnt
# touch testfile
# chown 100.100 testfile
# runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx testfile
setfacl: tesfile: Operation not permited
```
(runas is part of the xfs test suite)

virtiofsd has `CAP_DAC_READ_SEARCH` but (before calling setxattr) `open_by_handle_at()` returns `EPERM` anyway:

```rust
// passthrough/mod.rs
fn setxattr (..) {
     let file = self.open_inode(...) {
          data.open_file(...)
               // calls
               // passthrough/inode_store.rs
                FileOrHandle::Handle(h) => {
                    let new_file = h.open(flags)?;
                                      // calls
                                      // passthrough/file_handle.rs
                                      fn do_open(&self, mount_fd: &impl AsRawFd, flags: libc::c_int) -> io::Result<File> {
                                              let ret = unsafe { open_by_handle_at(mount_fd.as_raw_fd(), &self.handle.handle, flags) };
                                                                   ^--- this returns EPERM
```
---
https://gitlab.com/virtio-fs/virtiofsd/-/issues/56



More information about the Virtio-fs mailing list