Bug 979321 - SELinux is preventing /usr/sbin/mdadm from 'read' accesses on the blk_file md127.
Summary: SELinux is preventing /usr/sbin/mdadm from 'read' accesses on the blk_file md...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:22cca8095a629890a6be16b0979...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-28 08:40 UTC by Jan Sedlák
Modified: 2013-07-29 08:50 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-29 08:50:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jan Sedlák 2013-06-28 08:40:05 UTC
Description of problem:
SELinux is preventing /usr/sbin/mdadm from 'read' accesses on the blk_file md127.

*****  Plugin device (91.4 confidence) suggests  *****************************

If you want to allow mdadm to have read access on the md127 blk_file
Then you need to change the label on md127 to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE 'md127'
# restorecon -v 'md127'

*****  Plugin catchall (9.59 confidence) suggests  ***************************

If you believe that mdadm should be allowed read access on the md127 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 mdadm /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:mdadm_t:s0-s0:c0.c1023
Target Context                system_u:object_r:device_t:s0
Target Objects                md127 [ blk_file ]
Source                        mdadm
Source Path                   /usr/sbin/mdadm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           mdadm-3.2.6-19.fc19.i686
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-54.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.9.5-301.fc19.i686 #1 SMP Tue Jun
                              11 20:01:50 UTC 2013 i686 i686
Alert Count                   2
First Seen                    2013-06-28 04:38:39 EDT
Last Seen                     2013-06-28 04:38:41 EDT
Local ID                      9bd32a27-d2ff-4a7f-ad54-95f7ff4b1a1c

Raw Audit Messages
type=AVC msg=audit(1372408721.295:438): avc:  denied  { read } for  pid=2213 comm="mdadm" name="md127" dev="devtmpfs" ino=30193 scontext=system_u:system_r:mdadm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=blk_file


type=AVC msg=audit(1372408721.295:438): avc:  denied  { open } for  pid=2213 comm="mdadm" path="/dev/md127" dev="devtmpfs" ino=30193 scontext=system_u:system_r:mdadm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=blk_file


type=SYSCALL msg=audit(1372408721.295:438): arch=i386 syscall=open success=yes exit=ESRCH a0=bfe2df01 a1=8000 a2=0 a3=0 items=0 ppid=2212 pid=2213 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=mdadm exe=/usr/sbin/mdadm subj=system_u:system_r:mdadm_t:s0-s0:c0.c1023 key=(null)

Hash: mdadm,mdadm_t,device_t,blk_file,read

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.5-301.fc19.i686
type:           libreport

Comment 1 Daniel Walsh 2013-06-28 11:32:57 UTC
107817936011e9ba8e28ed3136193f5342254f78 allows this access in git.

Basically this is a race condition, where the device gets created with the wrong label by the kernel, and mdadm access it before udev fixes the label.

Comment 2 Miroslav Grepl 2013-07-01 09:09:27 UTC
Has been fixed.

Comment 3 Jake Jackson 2013-07-28 03:19:25 UTC
Description of problem:
$ sudo mdadm --assemble --scan

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.5-301.fc19.x86_64
type:           libreport

Comment 4 Miroslav Grepl 2013-07-29 08:50:30 UTC
Please update to the latest policy.


Note You need to log in before you can comment on or make changes to this bug.