Bug 2144906

Summary: [virtiofsd] Allow running virtiofsd unprivileged (without user namespaces)
Product: Red Hat Enterprise Linux 9 Reporter: Vivek Goyal <vgoyal>
Component: virtiofsdAssignee: German Maglione <gmaglione>
Status: CLOSED ERRATA QA Contact: xiagao
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.2CC: afrosi, coli, gmaglione, jcanocan, jinzhao, juzhang, lpivarc, sgott, slopezpa, virt-maint, vromanso, xiagao
Target Milestone: rcKeywords: RFE, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: virtiofsd-1.5.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:46:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2123070    
Bug Blocks:    

Description Vivek Goyal 2022-11-22 17:10:26 UTC
Description of problem:

Currently virtiofsd can not run unprivileged. To be precise, an unprivileged user can run it but use of user namespaces is required.

Kubevirt/CNV folks want to run virtiofsd unprivileged but can not make use of user namepsaces yet.

Opening this bug to allow running virtiofsd unprivileged without requiring usage of user namespaces.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 German Maglione 2022-11-23 16:01:26 UTC
This is already supported upstream. It'll be fixed with the rebase (BZ 2123070).

Comment 8 xiagao 2023-01-13 09:25:03 UTC
Test pkg: 
virtiofsd-1.5.0-1.el9.x86_64 
kernel-5.14.0-226.el9.x86_64(host)  
kernel-5.14.0-231.el9.x86_64(guest)

Test with the following steps:
1. switch to user u3, start virtiofsd with sandbox=none and start a RHEL9.2 VM1.
[u3@dell-per440-06 ~]$ /usr/libexec/virtiofsd --socket-path ./sock1 --shared-dir /home/u3/test -d --sandbox none
[2023-01-13T08:42:50Z WARN  virtiofsd] Use of deprecated flag '-d': Please use the '--log-level debug' option instead
[2023-01-13T08:42:50Z WARN  virtiofsd::limits] Failure when trying to set the limit to 1000000, the hard limit (8192) of open file descriptors is used instead.
[2023-01-13T08:42:50Z INFO  virtiofsd] Waiting for vhost-user socket connection...

2. in guest, mount virtiofs.
3. create a file on host.
-rw-r--r--. 1 u3 u3 18 Jan 13 04:18 file

4. read the file on guest. --Success
5. write in the shared dir on guest.
# echo test > file2  --success
6. try to change the file's owner and group on guest --failed as expected.
#chgrp root file
chgrp: changing group of 'file': operation not permitted

The basic function works for this bug, I will change verified status.

Comment 10 errata-xmlrpc 2023-05-09 07:46:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virtiofsd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2334