Bug 1000641

Summary: SELinux is preventing /usr/bin/qemu-system-x86_64 from 'getattr' accesses on the filesystem /run/media/derekm/LIVE.
Product: [Fedora] Fedora Reporter: Derek P. Moore <derek.p.moore>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:a816d1f09c6ee6ecd8f16edc9011242e7420ba1b2fab2fc0deb6c0605be95f8d
Fixed In Version: selinux-policy-3.12.1-74.1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-08 00:36:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Derek P. Moore 2013-08-23 23:25:32 UTC
Description of problem:
Used GNOME Boxes to create a VM with installation ISO on USB media.
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'getattr' accesses on the filesystem /run/media/derekm/LIVE.

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

If you believe that qemu-system-x86_64 should be allowed getattr access on the LIVE filesystem 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                unconfined_u:system_r:svirt_t:s0:c530,c772
Target Context                system_u:object_r:dosfs_t:s0
Target Objects                /run/media/derekm/LIVE [ filesystem ]
Source                        qemu-system-x86
Source Path                   /usr/bin/qemu-system-x86_64
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           qemu-system-x86-1.4.2-7.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-71.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.10.9-200.fc19.x86_64 #1 SMP Wed
                              Aug 21 19:27:58 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-08-23 11:18:40 CDT
Last Seen                     2013-08-23 11:18:40 CDT
Local ID                      829e88de-e54e-4e68-ac6c-d9f0e86f6938

Raw Audit Messages
type=AVC msg=audit(1377274720.61:578): avc:  denied  { getattr } for  pid=7875 comm="qemu-system-x86" name="/" dev="sdb1" ino=1 scontext=unconfined_u:system_r:svirt_t:s0:c530,c772 tcontext=system_u:object_r:dosfs_t:s0 tclass=filesystem


type=SYSCALL msg=audit(1377274720.61:578): arch=x86_64 syscall=fstatfs success=no exit=EACCES a0=10 a1=7fffda9a6a50 a2=0 a3=1 items=0 ppid=1 pid=7875 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 ses=1 tty=(none) comm=qemu-system-x86 exe=/usr/bin/qemu-system-x86_64 subj=unconfined_u:system_r:svirt_t:s0:c530,c772 key=(null)

Hash: qemu-system-x86,svirt_t,dosfs_t,filesystem,getattr

Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.10.9-200.fc19.x86_64
type:           libreport

Comment 1 Derek P. Moore 2013-08-23 23:28:03 UTC
Also, libreport does not detect GNOME 3 system-wide proxy settings for submitting bug reports to Bugzilla. :) I should probably enter that as a new bug.

Comment 2 Daniel Walsh 2013-08-26 20:04:41 UTC
So you image is installed on a fat file system?

Comment 3 Derek P. Moore 2013-08-26 22:07:01 UTC
Sure enough:
/dev/sdb1 on /run/media/derekm/LIVE type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

File is "en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso"

Comment 4 Daniel Walsh 2013-08-28 17:45:11 UTC
Do you have the virt_use_usb boolean turned on?

Comment 5 Daniel Walsh 2013-08-28 17:45:35 UTC
ff1e3933b46537f258292e95708b5cd78ec7ba74 fixes this in git.

Comment 6 Derek P. Moore 2013-08-28 18:00:31 UTC
No, I haven't explicitly set anything with setsebool. This install is brand new and pretty much virgin/stock.

Comment 7 Daniel Walsh 2013-08-28 20:15:39 UTC
Ok turn that boolean on and see if everything works.

It will still have a the AVC, but I want to know if you see any other problems.

# setsebool -P virt_use_usb 1

Comment 8 Miroslav Grepl 2013-08-29 08:58:22 UTC
Back ported.

Comment 9 Fedora Update System 2013-09-03 19:56:37 UTC
selinux-policy-3.12.1-74.1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-74.1.fc19

Comment 10 Fedora Update System 2013-09-05 01:38:00 UTC
Package selinux-policy-3.12.1-74.1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 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.12.1-74.1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15819/selinux-policy-3.12.1-74.1.fc19
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-09-08 00:36:00 UTC
selinux-policy-3.12.1-74.1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Derek P. Moore 2013-09-09 13:33:10 UTC
I saw the update come thru so I tested the "setsebool -P virt_use_usb 1" solution prior to update, it did not work, still got the getattr error.

Undid bool operation with "setsebool -P virt_use_usb 0" and installed new selinux-policy-3.12.1-74.1.fc19.noarch, ejected and reinserted USB thumbdrive, reopened GNOME Boxes, and now I get 'Connection to "_name_of_vm_" failed'.

Do I need to reboot/relabel or something?

Thanks!

Comment 13 Derek P. Moore 2013-09-09 13:38:07 UTC
Sorry, I reset "setsebool -P virt_use_usb 1" and now it appears to be working without the getattr warning.

I don't know whether virt_use_usb defaults to 0 or 1, but with it set to 0 it was failing on "open", with it set to 1 there is no longer an issue with "getattr".

Thanks again!