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 1812427 - Failed to start guest with virtiofs filesystem device if starting libvirtd foreground
Summary: Failed to start guest with virtiofs filesystem device if starting libvirtd fo...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-11 10:18 UTC by yafu
Modified: 2021-09-11 07:26 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-09-11 07:26:55 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)

Description yafu 2020-03-11 10:18:46 UTC
Description of problem:
Start libvirtd foreground, then start a guest with virtiofs device:
# virsh start vm1
error: Failed to start domain vm1
error: internal error: process exited while connecting to monitor: 2020-03-11T09:58:02.174949Z qemu-kvm: -chardev socket,id=chr-vu-ua-1035e984-8238-46e1-bf56-b546246e1a39,path=/var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock: Failed to connect socket /var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock: Permission denied

Version-Release number of selected component (if applicable):
libvirt-6.0.0-9.el8.x86_64
qemu-kvm-4.2.0-13.module+el8.2.0+5898+fb4bceae.x86_64
selinux-policy-3.14.3-40.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1.Start libvirtd foreground:
#systemctl stop libvirtd
#systemctl stop virtlogd
#virtlogd -d
#libvirtd -d

2.Prepare a guest with virtiofs filesystem device:
#virsh edit vm1
...
 <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB'/>
    </hugepages>
    <access mode='shared'/>
  </memoryBacking>
...
<cpu mode='host-model' check='partial'>
    <numa>
      <cell id='0' cpus='0-7' memory='2097152' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>
...
<device>
...
<filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs' queue='1024'/>
      <binary path='/usr/libexec/virtiofsd' xattr='on'>
        <cache mode='always'/>
        <lock posix='on' flock='on'/>
      </binary>
      <source dir='/path'/>
      <target dir='mount_tag'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </filesystem>
...
</device>

3.Start guest:
#virsh start vm1
error: Failed to start domain vm1
error: internal error: process exited while connecting to monitor: 2020-03-11T09:58:02.174949Z qemu-kvm: -chardev socket,id=chr-vu-ua-1035e984-8238-46e1-bf56-b546246e1a39,path=/var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock: Failed to connect socket /var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock: Permission denied

Actual results:


Expected results:
qemu-kvm permission denied when connecting to the virtiofsd.sock if starting libvirtd foreground

Additional info:
1.Check syslog:
SELinux is preventing qemu-kvm from connectto access on the unix_stream_socket /var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock. For complete SELinux messages run: sealert -l 635d00e4-cafe-47c0-94f2-bd07a72d4e34

2.# ausearch -m AVC -ts boot | grep -i qemu-kvm
type=AVC msg=audit(1583920682.174:161643): avc:  denied  { connectto } for  pid=3030821 comm="qemu-kvm" path="/var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock" scontext=unconfined_u:unconfined_r:svirt_t:s0:c173,c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0:c173,c1023 tclass=unix_stream_socket permissive=0

Comment 2 Zdenek Pytela 2021-03-29 18:19:53 UTC
Hi,

I'd like to ask if this is a common scenario in real deployment or if it is for testing purposes only:

> 1.Start libvirtd foreground:
> #systemctl stop libvirtd
> #systemctl stop virtlogd
> #virtlogd -d
> #libvirtd -d

Altough there is no process name in the denial:
> type=AVC msg=audit(1583920682.174:161643): avc:  denied  { connectto } for  pid=3030821 comm="qemu-kvm" path="/var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock" scontext=unconfined_u:unconfined_r:svirt_t:s0:c173,c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0:c173,c1023 tclass=unix_stream_socket permissive=0

the content clearly indicates it is a service in the unconfined_t domain which is assigned to processes running from the console, and this is not a problem to be addressed in selinux-policy.

Comment 3 yafu 2021-03-30 01:11:51 UTC
(In reply to Zdenek Pytela from comment #2)
> Hi,
> 
> I'd like to ask if this is a common scenario in real deployment or if it is
> for testing purposes only:

There is layer product using this scenario not just for testing.

> 
> > 1.Start libvirtd foreground:
> > #systemctl stop libvirtd
> > #systemctl stop virtlogd
> > #virtlogd -d
> > #libvirtd -d
> 
> Altough there is no process name in the denial:
> > type=AVC msg=audit(1583920682.174:161643): avc:  denied  { connectto } for  pid=3030821 comm="qemu-kvm" path="/var/lib/libvirt/qemu/domain-6-vm1/ua-1035e984-8238-46e1-bf56-b546246e1a39-virtiofsd.sock" scontext=unconfined_u:unconfined_r:svirt_t:s0:c173,c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0:c173,c1023 tclass=unix_stream_socket permissive=0
> 
> the content clearly indicates it is a service in the unconfined_t domain
> which is assigned to processes running from the console, and this is not a
> problem to be addressed in selinux-policy.

Thanks for your suggestion. I will change the component to libvirt.

Comment 5 John Ferlan 2021-09-08 13:30:58 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 6 RHEL Program Management 2021-09-11 07:26:55 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


Note You need to log in before you can comment on or make changes to this bug.