]> Git Repo - qemu.git/commit
virtiofsd: Fix xattr operations
authorMisono Tomohiro <[email protected]>
Thu, 27 Feb 2020 05:59:27 +0000 (14:59 +0900)
committerDr. David Alan Gilbert <[email protected]>
Tue, 3 Mar 2020 15:13:24 +0000 (15:13 +0000)
commitbdfd66788349acc43cd3f1298718ad491663cfcc
treeb434c62919409565efd51d4840291abed6150857
parent16e15a73089102c3d8846792d514e769300fcc3c
virtiofsd: Fix xattr operations

Current virtiofsd has problems about xattr operations and
they does not work properly for directory/symlink/special file.

The fundamental cause is that virtiofsd uses openat() + f...xattr()
systemcalls for xattr operation but we should not open symlink/special
file in the daemon. Therefore the function is restricted.

Fix this problem by:
 1. during setup of each thread, call unshare(CLONE_FS)
 2. in xattr operations (i.e. lo_getxattr), if inode is not a regular
    file or directory, use fchdir(proc_loot_fd) + ...xattr() +
    fchdir(root.fd) instead of openat() + f...xattr()

    (Note: for a regular file/directory openat() + f...xattr()
     is still used for performance reason)

With this patch, xfstests generic/062 passes on virtiofs.

This fix is suggested by Miklos Szeredi and Stefan Hajnoczi.
The original discussion can be found here:
  https://www.redhat.com/archives/virtio-fs/2019-October/msg00046.html

Signed-off-by: Misono Tomohiro <[email protected]>
Message-Id: <20200227055927[email protected]>
Acked-by: Vivek Goyal <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
tools/virtiofsd/fuse_virtio.c
tools/virtiofsd/passthrough_ll.c
tools/virtiofsd/seccomp.c
This page took 0.034691 seconds and 4 git commands to generate.