Bug 826299

Summary: SELinux is preventing /usr/bin/qemu-kvm from 'write' accesses on the blk_file sda1.
Product: [Fedora] Fedora Reporter: Ricardo Alves Teixeira <rtmetz92>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: berrange, clalancette, crobinso, dominick.grift, dougsland, dwalsh, itamar, jforbes, jyang, laine, libvirt-maint, mgrepl, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:eba7878b1504046139ef10ac926a59b2cbe7f36eb26bf175117bb1cacecc5e69
Fixed In Version: Doc Type: Bug Fix
Doc Text:
se
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-21 17:07:31 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ricardo Alves Teixeira 2012-05-29 19:47:15 EDT
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.3.7-1.fc17.x86_64
time:           Wed 30 May 2012 12:46:37 AM WEST

description:
:SELinux is preventing /usr/bin/qemu-kvm from 'write' accesses on the blk_file sda1.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that qemu-kvm should be allowed write access on the sda1 blk_file 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-kvm /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:svirt_t:s0:c154,c176
:Target Context                system_u:object_r:virt_content_t:s0
:Target Objects                sda1 [ blk_file ]
:Source                        qemu-kvm
:Source Path                   /usr/bin/qemu-kvm
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           qemu-system-x86-1.0-17.fc17.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-125.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.3.7-1.fc17.x86_64 #1 SMP Mon
:                              May 21 22:32:19 UTC 2012 x86_64 x86_64
:Alert Count                   1
:First Seen                    Wed 30 May 2012 12:45:28 AM WEST
:Last Seen                     Wed 30 May 2012 12:45:28 AM WEST
:Local ID                      6675601d-ab49-482c-bc88-4017e2fad10b
:
:Raw Audit Messages
:type=AVC msg=audit(1338335128.295:229): avc:  denied  { write } for  pid=2595 comm="qemu-kvm" name="sda1" dev="devtmpfs" ino=51644 scontext=system_u:system_r:svirt_t:s0:c154,c176 tcontext=system_u:object_r:virt_content_t:s0 tclass=blk_file
:
:
:type=SYSCALL msg=audit(1338335128.295:229): arch=x86_64 syscall=open success=no exit=EACCES a0=7f78f5a33900 a1=81002 a2=0 a3=48 items=0 ppid=1 pid=2595 auid=4294967295 uid=107 gid=107 euid=107 suid=107 fsuid=107 egid=107 sgid=107 fsgid=107 tty=(none) ses=4294967295 comm=qemu-kvm exe=/usr/bin/qemu-kvm subj=system_u:system_r:svirt_t:s0:c154,c176 key=(null)
:
:Hash: qemu-kvm,svirt_t,virt_content_t,blk_file,write
:
:audit2allowunable to open /sys/fs/selinux/policy:  Permission denied
:
:
:audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied
:
:
Comment 1 Miroslav Grepl 2012-05-30 04:31:54 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
se
Comment 2 Cole Robinson 2012-06-07 17:45:30 EDT
Miroslav, I assume that technical note piece was an accident. Can you explain what the issue is here? It claims the file is labeled virt_content_t so I don't understand the issue.
Comment 3 Daniel Walsh 2012-06-08 06:37:19 EDT
Content under /dev should never be labeled virt_content_t, it is not virt_content_t, it is either a fixed_disk_device_t or a removable_device_t. In this AVC it looks like libvirt relabeled the device sda1 to virt_content_t in stead of fixed_disk_device_t.  The avc is fine, since we do not want svirt_t able to write to virt_content_t.
Comment 4 Cole Robinson 2012-10-21 17:07:31 EDT
(In reply to comment #3)
> Content under /dev should never be labeled virt_content_t, it is not
> virt_content_t, it is either a fixed_disk_device_t or a removable_device_t.
> In this AVC it looks like libvirt relabeled the device sda1 to
> virt_content_t in stead of fixed_disk_device_t.  The avc is fine, since we
> do not want svirt_t able to write to virt_content_t.

There's another bug tracking similar issues with /dev/sr0, duping to that.

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