Bug 984122 - SELinux is preventing /usr/bin/qemu-system-x86_64 from 'read' accesses on the file /var/lib/libvirt/images/ubuntu.img.
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'read' accesses on the...
Product: Fedora
Classification: Fedora
Component: libvirt (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-07-12 17:49 EDT by nospam
Modified: 2015-09-11 09:11 EDT (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-30 18:13:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description nospam 2013-07-12 17:49:01 EDT
Description of problem:
startart VM via virt-manager in this case it was kubuntu 11.10
mount read only vm drive i used this command uestmount -a /var/lib/libvirt/images/ubuntu2.img -i --ro /media/xp/
try to cd into vm and try to copy something from VM
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'read' accesses on the file /var/lib/libvirt/images/ubuntu.img.

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

If you believe that qemu-system-x86_64 should be allowed read access on the ubuntu.img 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:
# 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:c802,c818
Target Context                system_u:object_r:virt_image_t:s0
Target Objects                /var/lib/libvirt/images/ubuntu.img [ file ]
Source                        qemu-system-x86
Source Path                   /usr/bin/qemu-system-x86_64
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-59.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.9-301.fc19.x86_64 #1 SMP Thu
                              Jul 4 15:10:36 UTC 2013 x86_64 x86_64
Alert Count                   755
First Seen                    2013-07-10 00:51:53 CEST
Last Seen                     2013-07-10 00:52:22 CEST
Local ID                      b5be4051-edc3-4a14-96dc-08ed5d6e9c4c

Raw Audit Messages
type=AVC msg=audit(1373410342.284:4767): avc:  denied  { read } for  pid=23474 comm="qemu-system-x86" path="/var/lib/libvirt/images/ubuntu.img" dev="sdb2" ino=2887811 scontext=system_u:system_r:svirt_t:s0:c802,c818 tcontext=system_u:object_r:virt_image_t:s0 tclass=file

Hash: qemu-system-x86,svirt_t,virt_image_t,file,read

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.9-301.fc19.x86_64
type:           libreport
Comment 1 Cole Robinson 2013-08-30 18:13:13 EDT
Thanks for the report.

I think trying to mount the image on your host while your VM was using it restored the image to its default label (that of /var/lib/libvirt/images) and qemu-system-x86_64 can no longer access it. If you are messing with images behind libvirt's back there isn't much we can do here, so I call this NOTABUG.
Comment 2 Miroslav Grepl 2015-09-11 09:11:25 EDT
*** Bug 1261266 has been marked as a duplicate of this bug. ***

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