Bug 1016326

Summary: SELinux is preventing /usr/bin/qemu-system-x86_64 from 'attach_queue' accesses on the tun_socket .
Product: [Fedora] Fedora Reporter: Cole Robinson <crobinso>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: berrange, clalancette, dominick.grift, dwalsh, eparis, itamar, jforbes, laine, libvirt-maint, lvrabec, mgrepl, pmoore, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:fa97a3f8f14e8107bddc0c66f5d957f52347eb00d804f5edc43440b9971a94af
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-07 15:35:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Cole Robinson 2013-10-07 23:07:02 UTC
Description of problem:
Configured multiqueue virtio-net with libvirt, then ran this inside the guest:

ethtool -L eth0 combined 4

Where there should be 4 tap FDs allocated to the guest for each queue. FWIW I think this is supposed to work
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'attach_queue' accesses on the tun_socket .

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that qemu-system-x86_64 should be allowed attach_queue access on the  tun_socket by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep qemu-system-x86 /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:svirt_t:s0:c194,c501
Target Context                system_u:system_r:virtd_t:s0-s0:c0.c1023
Target Objects                 [ tun_socket ]
Source                        qemu-system-x86
Source Path                   /usr/bin/qemu-system-x86_64
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           qemu-system-x86-1.6.0-8.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-83.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.11.3-301.fc20.x86_64 #1 SMP Thu
                              Oct 3 00:57:21 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-10-07 19:04:31 EDT
Last Seen                     2013-10-07 19:04:31 EDT
Local ID                      a137a3fd-1922-4b2d-ba88-b30cd8472aa0

Raw Audit Messages
type=AVC msg=audit(1381187071.716:2194): avc:  denied  { attach_queue } for  pid=27690 comm="qemu-system-x86" scontext=system_u:system_r:svirt_t:s0:c194,c501 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=tun_socket


type=SYSCALL msg=audit(1381187071.716:2194): arch=x86_64 syscall=ioctl success=yes exit=0 a0=1e a1=400454d9 a2=7feb9926d850 a3=0 items=0 ppid=1 pid=27690 auid=4294967295 uid=107 gid=107 euid=107 suid=107 fsuid=107 egid=107 sgid=107 fsgid=107 ses=4294967295 tty=(none) comm=qemu-system-x86 exe=/usr/bin/qemu-system-x86_64 subj=system_u:system_r:svirt_t:s0:c194,c501 key=(null)

Hash: qemu-system-x86,svirt_t,virtd_t,tun_socket,attach_queue

Additional info:
reporter:       libreport-2.1.7
hashmarkername: setroubleshoot
kernel:         3.11.3-301.fc20.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-10-09 14:10:26 UTC
I think libvirt would need to relabel the tun_socket to match the svirt_t label to make this secure.

Comment 2 Cole Robinson 2014-10-07 15:35:31 UTC

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