Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1910205

Summary: Adding trusted.* xattr on virtiofs returns "Operation not permitted"
Product: Red Hat Enterprise Linux 8 Reporter: Boyang Xue <bxue>
Component: qemu-kvmAssignee: Dr. David Alan Gilbert <dgilbert>
qemu-kvm sub component: virtio-fs QA Contact: menli <menli>
Status: CLOSED DUPLICATE Docs Contact:
Severity: high    
Priority: high CC: dgilbert, drjones, fs-qe, lijin, virt-maint, xzhou
Version: 8.4Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.4   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-02 19:36:48 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:

Description Boyang Xue 2020-12-23 06:06:22 UTC
Description of problem:
With the latest RHEL-8.4 kernel and qemu-kvm packages, adding user.* xattr on virtiofs is good, but adding trusted.* xattr on virtiofs fails with "Operation not permitted". The same test is good on RHEL-8.2.0.

RHEL-8.4
kernel-4.18.0-265.el8 (the same version on host and guest)
qemu-kvm-5.2.0-1.module+el8.4.0+9091+650b220a
libvirt-6.10.0-1.module+el8.4.0+8898+a84e86e1
```
[root@localhost ~]# mount -t virtiofs test /test/
[root@localhost ~]# touch /test/mytest; setfattr -n "trusted.xfstests" -v "attr" /test/mytest; echo $?           
setfattr: /test/mytest: Operation not permitted          
1
```

RHEL-8.2.0
kernel-4.18.0-193.el8 (the same version on host and guest)
qemu-kvm-4.2.0-19.module+el8.2.0+6296+6b821950
libvirt-6.0.0-17.module+el8.2.0+6257+0d066c28
```
[root@dhcp130-212 repo_xfstests]# mount -t virtiofs test /test/
[root@dhcp130-212 repo_xfstests]# touch /test/mytest; setfattr -n "trusted.xfstests" -v "attr" /test/mytest; echo $?                                                                                         
0
```

Guest VM and virtiofs are configured in libvirt as follows:
```
<filesystem type='mount' accessmode='passthrough'>
        <binary path='/usr/libexec/virtiofsd' xattr='on'/>
        <driver type='virtiofs'/>
        <source dir='/mnt/test'/>
        <target dir='test'/>
</filesystem>
<filesystem type='mount' accessmode='passthrough'>
        <binary path='/usr/libexec/virtiofsd' xattr='on'/>
        <driver type='virtiofs'/>
        <source dir='/mnt/scratch'/>
        <target dir='scratch'/> 
</filesystem>
```

Version-Release number of selected component (if applicable):
qemu-kvm-5.2.0-1.module+el8.4.0+9091+650b220a

How reproducible:
100%

Steps to Reproduce:
See description above

Actual results:
setfattr fails

Expected results:
setfattr returns 0

Additional info:
N/A

Comment 1 Boyang Xue 2020-12-23 06:13:14 UTC
Yes I'm aware of

Bug 1849147 - virtiofsd: Allow setting trusted attributes for containers in containers

and

Bug 1860491 - overlayfs trusted.* xattr support without CAP_SYS_ADMIN

But qemu-kvm version in my failed test above is exactly the same as the "fixed version" in Bug 1860491, it looks like still broken.

Comment 2 menli@redhat.com 2020-12-23 06:22:38 UTC
(In reply to Boyang Xue from comment #1)
> Yes I'm aware of
> 
> Bug 1849147 - virtiofsd: Allow setting trusted attributes for containers in
> containers
> 
> and
> 
> Bug 1860491 - overlayfs trusted.* xattr support without CAP_SYS_ADMIN
> 
> But qemu-kvm version in my failed test above is exactly the same as the
> "fixed version" in Bug 1860491, it looks like still broken.

yes,about Bug 1860491 - overlayfs trusted.* xattr support without CAP_SYS_ADMIN, I should still be broken, for I still can reproduce it and I add comment like https://bugzilla.redhat.com/show_bug.cgi?id=1860491#c18

Comment 3 Boyang Xue 2020-12-23 06:34:19 UTC
Please don't mind I add dgilbert (the owner of Bug 1860491) to cc list.

Comment 7 menli@redhat.com 2021-01-14 02:03:56 UTC
This bug should duplicated of Bug 1860491 - overlayfs trusted.* xattr support without CAP_SYS_ADMIN  and depend on  Bug 1854595 - virtiofsd sandboxing requires CAP_SYS_ADMIN and does not run in a container

Comment 8 Dr. David Alan Gilbert 2021-02-02 19:36:48 UTC
I've just added some notes to 1860491 to clarify how to do this; will dupe this bz to there.

*** This bug has been marked as a duplicate of bug 1860491 ***