Bug 1013204

Summary: SELinux is preventing hdparm from 'read' accesses on the blk_file sda.
Product: [Fedora] Fedora Reporter: Heiko Adams <bugzilla>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: bugzilla, dominick.grift, dwalsh, jkaluza, jskarvad, jv+fedora, lvrabec, mgrepl, pknirsch, twoerner
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:e682c101dd649c75794bcc82330a6b76545f2e1455abb68567ac8951cee3d028
Fixed In Version: selinux-policy-3.12.1-192.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-07 20:47:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Heiko Adams 2013-09-28 10:20:52 UTC
Description of problem:
SELinux is preventing hdparm from 'read' accesses on the blk_file sda.

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

If sie denken, dass es hdparm standardmässig erlaubt sein sollte, read Zugriff auf sda 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 hdparm /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:tuned_t:s0
Target Context                system_u:object_r:fixed_disk_device_t:s0
Target Objects                sda [ blk_file ]
Source                        hdparm
Source Path                   hdparm
Port                          <Unbekannt>
Host                          (removed)
Source RPM Packages           hdparm-9.43-5.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-83.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.1-300.fc20.x86_64 #1 SMP Sat
                              Sep 14 15:01:23 UTC 2013 x86_64 x86_64
Alert Count                   3
First Seen                    2013-09-28 12:07:35 CEST
Last Seen                     2013-09-28 12:19:28 CEST
Local ID                      f2a60dee-fa56-43fd-a9e3-fb2673cde61c

Raw Audit Messages
type=AVC msg=audit(1380363568.221:434): avc:  denied  { read } for  pid=3145 comm="hdparm" name="sda" dev="devtmpfs" ino=6615 scontext=system_u:system_r:tuned_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file


type=SYSCALL msg=audit(1380363568.221:434): arch=x86_64 syscall=open success=no exit=EACCES a0=7fff3ae8af8e a1=800 a2=0 a3=19 items=0 ppid=568 pid=3145 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=hdparm exe=/usr/sbin/hdparm subj=system_u:system_r:tuned_t:s0 key=(null)

Hash: hdparm,tuned_t,fixed_disk_device_t,blk_file,read

Additional info:
reporter:       libreport-2.1.7
hashmarkername: setroubleshoot
kernel:         3.11.1-300.fc20.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-09-28 10:57:10 UTC
Does tuned actually have to read the disk device?  This basically would allow it to read any file on the system.

Comment 2 Miroslav Grepl 2013-10-07 11:41:03 UTC
What does

$ ls -Z `which hdparm`

I believe you will need to fix labeling on your system.

Comment 3 Miroslav Grepl 2013-10-07 11:48:19 UTC
Dan,
tuned is so close unconfined domain.

Comment 4 Heiko Adams 2013-10-07 12:23:06 UTC
$ ls -Z `which hdparm`
-rwxr-xr-x. root root unconfined_u:object_r:fsadm_exec_t:s0 /usr/sbin/hdparm

Comment 5 Daniel Walsh 2013-10-07 13:53:28 UTC
Yes I think we should make it unconfined by default.

Lets add a fsadm_domtrans though