Bug 1055168

Summary: SELinux is preventing /usr/bin/qemu-system-x86_64 from 'write' accesses on the blk_file /dev/dm-6.
Product: [Fedora] Fedora Reporter: Mateusz Marzantowicz <mmarzantowicz>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: berrange, clalancette, dominick.grift, dwalsh, itamar, jforbes, jyang, laine, libvirt-maint, lvrabec, mgrepl, mmarzantowicz, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:590e979f677bb8165cea87d13549dcb6b17543e4d02adf9ee7bad1347960f5dd
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-20 10:32:02 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 Mateusz Marzantowicz 2014-01-19 11:42:00 UTC
Description of problem:
It happened afer updating selinux-policy to selinux-policy-targeted-3.12.1-117.fc20.noarch. It's sad that happenes in stable Fedora.
SELinux is preventing /usr/bin/qemu-system-x86_64 from 'write' accesses on the blk_file /dev/dm-6.

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

If aby qemu-system-x86_64 powinno mieć domyślnie write dostęp do dm-6 blk_file.
Then proszę to zgłosić jako błąd.
Można utworzyć lokalny moduł polityki, aby umożliwić ten dostęp.
Do
można tymczasowo zezwolić na ten dostęp wykonując polecenia:
# grep qemu:Mail /var/log/audit/audit.log | audit2allow -M mojapolityka
# semodule -i mojapolityka.pp

Additional Information:
Source Context                system_u:system_r:svirt_t:s0:c9,c556
Target Context                system_u:object_r:fixed_disk_device_t:s0
Target Objects                /dev/dm-6 [ blk_file ]
Source                        qemu:Mail
Source Path                   /usr/bin/qemu-system-x86_64
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           qemu-system-x86-1.6.1-3.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-117.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.12.7-300.fc20.x86_64 #1 SMP Fri
                              Jan 10 15:35:31 UTC 2014 x86_64 x86_64
Alert Count                   3
First Seen                    2014-01-19 12:36:48 CET
Last Seen                     2014-01-19 12:37:22 CET
Local ID                      799702e4-2e49-49ea-bafd-ba55b9476469

Raw Audit Messages
type=AVC msg=audit(1390131442.612:2407): avc:  denied  { write } for  pid=23452 comm="qemu:Mail" path="/dev/dm-6" dev="devtmpfs" ino=14704 scontext=system_u:system_r:svirt_t:s0:c9,c556 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file


type=SYSCALL msg=audit(1390131442.612:2407): arch=x86_64 syscall=pwrite success=yes exit=4096 a0=10 a1=7f9327705000 a2=1000 a3=80121000 items=0 ppid=1 pid=23452 auid=4294967295 uid=107 gid=107 euid=107 suid=107 fsuid=107 egid=107 sgid=107 fsgid=107 ses=4294967295 tty=(none) comm=qemu:Mail exe=/usr/bin/qemu-system-x86_64 subj=system_u:system_r:svirt_t:s0:c9,c556 key=(null)

Hash: qemu:Mail,svirt_t,fixed_disk_device_t,blk_file,write

Additional info:
reporter:       libreport-2.1.11
hashmarkername: setroubleshoot
kernel:         3.12.7-300.fc20.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2014-01-19 19:55:54 UTC
*** Bug 1055171 has been marked as a duplicate of this bug. ***

Comment 2 Miroslav Grepl 2014-01-19 19:56:02 UTC
*** Bug 1055172 has been marked as a duplicate of this bug. ***

Comment 3 Miroslav Grepl 2014-01-19 19:56:14 UTC
*** Bug 1055175 has been marked as a duplicate of this bug. ***

Comment 4 Miroslav Grepl 2014-01-19 19:56:27 UTC
*** Bug 1055170 has been marked as a duplicate of this bug. ***

Comment 5 Miroslav Grepl 2014-01-19 20:03:19 UTC
How did you get it? By default or did you change the labeling?

Comment 6 Mateusz Marzantowicz 2014-01-19 20:59:04 UTC
I followd instructions from https://bugzilla.redhat.com/show_bug.cgi?id=1054350 to update my system. I did setenforce 0 and dnf distro-sync. Just after upgrade finished I was floded by selinux alerts (I think two per vm).

Here is my dnf history (what I did).

Transaction ID : 9
Begin time     : Sun Jan 19 12:36:20 2014
Begin rpmdb    : 1585:0d9f8682490a49290639f76d689942beb8642bd2
End time       :            12:37:10 2014 (50 seconds)
End rpmdb      : 1585:674d908ee68b7033903770170629bf019aa4958d
User           : Mateusz Marzantowicz <mmarzantowicz>
Return-Code    : Success
Command Line   : distro-sync
Transaction performed with:
    Installed     dnf-0.4.11-1.fc20.noarch @updates
    Installed     rpm-4.11.1-7.fc20.x86_64 (unknown)
Packages Altered:
    Upgraded initscripts-9.50-1.fc20.x86_64                    (unknown)
    Upgrade              9.51-1.fc20.x86_64                    @updates
    Upgraded nfs-utils-1:1.2.8-6.0.fc20.x86_64                 (unknown)
    Upgrade            1:1.2.9-2.1.fc20.x86_64                 @updates
    Upgraded selinux-policy-targeted-3.12.1-116.fc20.noarch    @updates
    Upgrade                          3.12.1-117.fc20.noarch    @updates
    Upgraded tcpdump-14:4.5.0-1.20131108gitb07944a.fc20.x86_64 (unknown)
    Upgrade          14:4.5.1-1.fc20.x86_64                    @updates

Comment 7 Miroslav Grepl 2014-01-20 08:08:15 UTC
Could you try to turn off/on running virtual machines?

Comment 8 Mateusz Marzantowicz 2014-01-20 09:34:47 UTC
I relabeled FS on boot yesterday and now I can't reproduce this behavior. I started/stopped virtual machines many time since then with SELinux in Permissive and Enforcing modes. It must have been some update side effect. I can try to downgrade and upgrade selinux-policy-targeted again to see I can trigger this error again.

Comment 9 Mateusz Marzantowicz 2014-01-20 09:39:06 UTC
To clarify things - I haven't modified anything in SELinux policy by myself. I'm only using policies contained in RPM.

Comment 10 Miroslav Grepl 2014-01-20 10:32:02 UTC
Ok, lets close this bug for now and please reopen if this happens again. Thank you.