Bug 1246247

Summary: libvirt should not change selinux label of /dev/sr0 if qemu can already access it
Product: [Fedora] Fedora Reporter: autarch princeps <autarch>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: agedosier, berrange, brian, clalancette, crobinso, dominick.grift, dwalsh, itamar, jforbes, laine, libvirt-maint, lvrabec, mgrepl, plautrba, rxguy, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:fa0344e188cf72546e973ddb607bbbb0c03178c7102362f48185e7ed9a77d33c
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-14 20:04:50 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 autarch princeps 2015-07-23 19:14:36 UTC
Description of problem:
SELinux is preventing systemd-logind from 'setattr' accesses on the blk_file sr0.

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

If sie denken, dass es systemd-logind standardmässig erlaubt sein sollte, setattr Zugriff auf sr0 blk_file zu erhalten.
Then sie sollten dies als Fehler melden.
Um diesen Zugriff zu erlauben, können Sie ein lokales Richtlinien-Modul erstellen.
Do
zugriff jetzt erlauben, indem Sie die nachfolgenden Befehle ausführen:
# grep systemd-logind /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:systemd_logind_t:s0
Target Context                system_u:object_r:virt_content_t:s0
Target Objects                sr0 [ blk_file ]
Source                        systemd-logind
Source Path                   systemd-logind
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-128.6.fc22.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 4.0.7-300.fc22.x86_64 #1 SMP Mon
                              Jun 29 22:15:06 UTC 2015 x86_64 x86_64
Alert Count                   3
First Seen                    2015-07-14 16:38:09 CEST
Last Seen                     2015-07-14 16:38:29 CEST
Local ID                      61790096-5a22-4990-80b8-8d2be7240de3

Raw Audit Messages
type=AVC msg=audit(1436884709.122:1474): avc:  denied  { setattr } for  pid=755 comm="systemd-logind" name="sr0" dev="devtmpfs" ino=12296 scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:virt_content_t:s0 tclass=blk_file permissive=1


Hash: systemd-logind,systemd_logind_t,virt_content_t,blk_file,setattr

Version-Release number of selected component:
selinux-policy-3.13.1-128.6.fc22.noarch

Additional info:
reporter:       libreport-2.6.1
hashmarkername: setroubleshoot
kernel:         4.1.2-200.fc22.x86_64
type:           libreport

Potential duplicate: bug 824137

Comment 1 Lukas Vrabec 2015-07-28 13:26:52 UTC
Looks this is same issue like bug 824137

Comment 2 Cole Robinson 2015-09-21 22:01:09 UTC
*** Bug 1153406 has been marked as a duplicate of this bug. ***

Comment 3 Cole Robinson 2015-09-21 22:03:24 UTC
What's happening here is libvirt is labelling /dev/sr0 as virt_content_t, which conflicts with logind labeling.

The proper fix IMO is for libvirt to not change the label for readonly disk images, if it's already labelled in such a way that we can already access it. I previously outlined on this upstream mailing list:

https://www.redhat.com/archives/libvir-list/2015-April/msg01400.html

Comment 4 Cole Robinson 2016-04-14 20:04:50 UTC

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