Bug 895161

Summary: PCI passthrough fails in qemu-kvm unless selinux is disabled
Product: [Fedora] Fedora Reporter: Laine Stump <laine>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.11.1-108.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-05 01:07:29 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Laine Stump 2013-01-14 12:44:12 EST
As far as I gather, the restrictions put in place by UEFI secure boot are roughly equivalent to CAP_COMPROMISE_KERNEL, and selinux has a policy called "compromise_kernel" that also checks for and prevents the same operations.

Assignment of host hardware to guests in qemu-kvm via its "-device pci-assign" option is known to fail on systems with UEFI secure boot. However, even on systems that don't have a UEFI BIOS,pci-assign is no longer working as of Fedora 18 unless the following three steps are taken (this is assuming that qemu-kvm is run by libvirtd):

1) clear_emulator_capabilies is set to 0 in /etc/libvirt/qemu.conf

2) qemu-kvm is run as root rather than as user qemu

3) selinux is set to permissive mode.

Items 1 and 2 can be solved in libvirt by making sure that CAP_COMPROMISE_KERNEL is set when pci passthrough will be required. Item 3 currently has no solution other than a blankete disabling of selinux, which is obviously not desired.

The solution would be to either unconditionally, or possibly as the result of an selinux boolean called virt_allow_compromise_kernel_t (or something like that), not check for [whatever compromise_kernel checks for] in processes that are svirt_t.

Without such a change, PCI passthrough will no longer work in F18+.
Comment 1 Daniel Walsh 2013-01-14 13:11:59 EST
Looks like this is fixed in selinux-policy-3.11.1-70.fc18.src.rpm

But Dan Berrange asked me to make this the default and remove virt_use_sysfs altogether, which is fine with me.  

c02f1786d5176b0367494d27280d036996c77cdc fixes this.
Comment 2 Fedora Update System 2013-12-19 18:59:21 EST
selinux-policy-3.11.1-108.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-108.fc18
Comment 3 Fedora Update System 2013-12-20 21:17:40 EST
Package selinux-policy-3.11.1-108.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.11.1-108.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-23716/selinux-policy-3.11.1-108.fc18
then log in and leave karma (feedback).
Comment 4 Fedora End Of Life 2013-12-21 10:43:45 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora Update System 2014-01-05 01:07:29 EST
selinux-policy-3.11.1-108.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.