Bug 1337333 - SELinux is preventing qemu-system-x86 from read, write access on the chr_file /dev/dri/renderD128.
Summary: SELinux is preventing qemu-system-x86 from read, write access on the chr_file...
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 24
Hardware: x86_64
OS: Unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
Whiteboard: abrt_hash:4d3881274010d12dcd37510cc98...
: 1364075 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2016-05-18 21:14 UTC by Cole Robinson
Modified: 2017-08-08 14:33 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-3.13.1-191.16.fc24
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-08-08 14:33:38 UTC
Type: ---

Attachments (Terms of Use)

Description Cole Robinson 2016-05-18 21:14:08 UTC
Description of problem:
Using spice GL with usermode libvirt. spice GL support needs access to the /dev/dri render node
SELinux is preventing qemu-system-x86 from read, write access on the chr_file /dev/dri/renderD128.

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

If you believe that qemu-system-x86 should be allowed read write access on the renderD128 chr_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
allow this access for now by executing:
# ausearch -c 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
# semodule -X 300 -i my-qemusystemx86.pp

Additional Information:
Source Context                unconfined_u:unconfined_r:svirt_t:s0:c112,c716
Target Context                system_u:object_r:dri_device_t:s0
Target Objects                /dev/dri/renderD128 [ chr_file ]
Source                        qemu-system-x86
Source Path                   qemu-system-x86
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-185.fc24.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 4.5.4-300.fc24.x86_64 #1 SMP Wed
                              May 11 17:57:16 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-05-18 17:10:15 EDT
Last Seen                     2016-05-18 17:10:15 EDT
Local ID                      4e2e089d-142b-4417-b3dd-417356fe5796

Raw Audit Messages
type=AVC msg=audit(1463605815.55:23715): avc:  denied  { read write } for  pid=8036 comm="qemu-system-x86" path="/dev/dri/renderD128" dev="devtmpfs" ino=13523 scontext=unconfined_u:unconfined_r:svirt_t:s0:c112,c716 tcontext=system_u:object_r:dri_device_t:s0 tclass=chr_file permissive=1

Hash: qemu-system-x86,svirt_t,dri_device_t,chr_file,read,write

Version-Release number of selected component:

Additional info:
reporter:       libreport-2.7.0
hashmarkername: setroubleshoot
kernel:         4.5.4-300.fc24.x86_64
reproducible:   Not sure how to reproduce the problem
type:           libreport

Comment 1 Cole Robinson 2016-05-18 21:17:37 UTC
Also hits open and ioctl access on that file. And read+open+getattr access on   udev_var_run_t /run/udev/data/+pci:0000:01:00.0  which is my video card, so probably related.

Maybe libvirt svirt 'fixes' this but then again I'm not sure if it's acceptable for libvirt to go out and change labels/permissions on video related bits, since we aren't giving exclusive access to the hw

Comment 2 Joachim Frieben 2016-08-11 08:35:04 UTC
I did not get that far under Fedora 24, because the directive <gl enable='yes'/> was remove by libvirt (?) from the corresponding configuration file whenever I added it.
However, I do observe the same issue (three different alerts suggesting the same change of policiy) under Fedora 25 which was reported as bug 1364075 by the SELinux Troubeshooter utility. After switching to permissive mode, accelerated VirGL 3D is up and running but implementing the policy rule

  ausearch -c 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
  semodule -X 300 -i my-qemusystemx86.pp

has -no- effect in my case.

Comment 3 Lukas Vrabec 2016-08-11 10:16:09 UTC
*** Bug 1364075 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2016-08-16 05:55:33 UTC
selinux-policy-3.13.1-191.11.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-c4630499f5

Comment 5 Joachim Frieben 2016-08-23 17:05:07 UTC
No improvement for selinux-policy-3.13.1-191.12.fc24.

Comment 6 Joachim Frieben 2016-08-29 03:51:23 UTC
As of selinux-policy-3.13.1-191.13.fc24, I do still get notified that

  "SELinux is preventing qemu-system-x86 from read access on the file +pci:0000:01:00.0."

but despite the host running in enforcing mode the virtual machine launched by means of 'virsh start ..' completes start-up successfully and VirGL 3D is enabled and active:

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Red Hat (0x1af4)
    Device: virgl (0x1010)
    Version: 12.0.1
    Accelerated: yes
    Video memory: 0MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: Red Hat

Comment 7 Fedora Admin XMLRPC Client 2016-09-27 15:12:14 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Joachim Frieben 2016-09-28 08:51:32 UTC
As of selinux-policy-3.13.1-191.16.fc24, a virtual Fedora 25 guest reliably starts up on a Fedora 24 host with VirGL 3D enabled and active, and no further SELinux alerts are reported.
For a virtual Fedora 24 guest, the graphical login manager crashes when trying to log in but this is likely to be a different issue. Anyway, no SELinux alerts are triggered in this case either.

Comment 9 Joachim Frieben 2016-10-01 12:07:18 UTC
Both Fedora 24 and 25 accelerated VirGL 3D sessions are working as expected with selinux-policy-3.13.1-191.16.fc24. Other issues like black virtual desktops are related to bug 1380894 and only occur in Fedora 24 "GNOME on Wayland" host sessions but are absent from Fedora 24 "GNOME" (on Xorg) host sessions.

Comment 10 Fedora End Of Life 2017-07-25 20:48:33 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. 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 EOL if it remains open with a Fedora  'version'
of '24'.

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.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 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 this bug is closed as described in the policy above.

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 11 Fedora End Of Life 2017-08-08 14:33:38 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

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