Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-15882

[virtio-win][virtiofs] Fail to create file when start virtiofs service with UID/GID in virtiofsd non-root user namespace

    • Normal
    • CustomerScenariosInitiative
    • sst_virtualization_windows
    • ssg_virtualization
    • 5
    • QE ack
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • Unspecified Release Note Type - Unknown
    • x86_64
    • Windows

      What were you trying to do that didn't work?
      Start virtiofsd with a non-root user, and enable a range of UID/GID to virtiofsd user namespace, then boot up a win2019 guest, and mount virtiofs with the mapping UID/GID. After the virtiofs was started, I tried to create a file in it, but failed.

      Please provide the package NVR for which bug is seen:
      qemu-kvm-8.1.0-2.el9.x86_64
      kernel-5.14.0-367.el9.x86_64
      virtiofsd-1.7.2-1.el9.x86_64
      edk2-ovmf-20230524-3.el9.noarch
      virtio-win-prewhql-0.1-242

      How reproducible:
      100%

      Steps to reproduce
      1. add a common user on host

      [root@dell-per750-33 home]# useradd user1

      [root@dell-per750-33 home]# id user1
      uid=1001(user1) gid=1001(user1) groups=1001(user1)

      2. get subuid of the common user

      [root@dell-per750-33 home]# cat /etc/subuid
      test:100000:65536
      user1:165536:65536

      3. give executable permission for the common user's home dir
      [root@dell-per750-33 home]# chmod -R go+x user1

      4. create a shared dir under user1's home dir and give write permission for all users.
      [root@dell-per750-33 user1]# ll
      total 0
      drwxrwxrwx 2 root root 47 Nov 3 04:06 test

      5. switch to user1 and start virtiofsd with mapping list '--uid-map :0:165536:65536: --gid-map :0:165536:65536'
      [user1@dell-per750-33 root]$ /usr/libexec/virtiofsd --shared-dir /home/user1/test --socket-path /tmp/sock2 --uid-map :0:165536:65536: --gid-map :0:165536:65536:
      [2023-11-07T02:46:32Z WARN virtiofsd::limits] Failure when trying to set the limit to 1000000, the hard limit (8192) of open file descriptors is used instead.
      [2023-11-07T02:46:32Z INFO virtiofsd] Waiting for vhost-user socket connection...

      ps aux |grep virtiofsd
      165536 1101269 0.0 0.0 5040 3616 pts/5 S+ 03:36 0:00 /usr/libexec/virtiofsd --shared-dir /home/user1/test --socket-path /tmp/sock2 --uid-map :0:165536:65536: --gid-map :0:165536:65536:
      165536 1101273 0.0 0.0 4317664 3784 pts/5 Sl+ 03:36 0:00 /usr/libexec/virtiofsd --shared-dir /home/user1/test --socket-path /tmp/sock2 --uid-map :0:165536:65536: --gid-map :0:165536:65536:

      6. boot up win2019 guest and start virtiofs.exe to get a shared volume.
      virtiofs.exe -o 165536:165536

      7. Try to create a file in the shared volume z:

      Expected results
      Create file successfully.

      Actual results
      Failed to create a file, it said 'File Too Large...'

      Other info:
      when start virtiofs.exe without "UID:GID", can create a new file.
      virtiofs.exe -o 0:0 , also can create a new file.

      The file on host.
      rw-rw-r- 1 165536 165536 0 Nov 6 21:53 dgf.txt
      rw-rw-r- 1 165536 165536 0 Nov 6 21:52 sfddf.txt

            yvugenfi@redhat.com Yan Vugenfirer
            rhn-support-xiagao Xiaoling Gao
            Meirav Dean Meirav Dean
            Xiaoling Gao Xiaoling Gao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: