xfs test generic/375 fails when using file handles
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
# chmod 2755 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:
// 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
Edited by German Maglione