Description of problem: Version-Release number of selected component (if applicable): selinux-policy-devel-2.4.6-304.el5 selinux-policy-minimum-2.4.6-304.el5 selinux-policy-strict-2.4.6-304.el5 selinux-policy-mls-2.4.6-304.el5 selinux-policy-2.4.6-304.el5 selinux-policy-targeted-2.4.6-304.el5 How reproducible: always Steps to Reproduce: # sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 21 Policy from config file: mls # id -Z root:sysadm_r:sysadm_t:SystemLow-SystemHigh # kpartx -v /dev/sda /dev/mapper/control: open failed: Permission denied Failure to communicate with kernel device-mapper driver. /dev/sda: Permission denied # Actual results: ---- time->Tue May 10 09:41:43 2011 type=SYSCALL msg=audit(1305034903.072:185): arch=c0000032 syscall=1028 success=no exit=-13 a0=60000fffff9a7d9c a1=0 a2=0 a3=20000000002b8238 items=0 ppid=13455 pid=29054 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS1 ses=1 comm="kpartx" exe="/sbin/kpartx" subj=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 key=(null) type=AVC msg=audit(1305034903.072:185): avc: denied { read } for pid=29054 comm="kpartx" name="sda" dev=tmpfs ino=2016 scontext=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 tcontext=system_u:object_r:fixed_disk_device_t:s15:c0.c1023 tclass=blk_file ---- time->Tue May 10 09:41:43 2011 type=SYSCALL msg=audit(1305034903.071:184): arch=c0000032 syscall=1028 success=no exit=-13 a0=60000fffff9a65f8 a1=2 a2=0 a3=20000000002b8238 items=0 ppid=13455 pid=29054 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS1 ses=1 comm="kpartx" exe="/sbin/kpartx" subj=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 key=(null) type=AVC msg=audit(1305034903.071:184): avc: denied { read write } for pid=29054 comm="kpartx" name="control" dev=tmpfs ino=2047 scontext=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 tcontext=system_u:object_r:lvm_control_t:s0 tclass=chr_file ---- Expected results: no AVCs
ls -lZ /sbin/kpartx If it is not labeled lvm_exec_t can you change its label to this, and try again chcon -t lvm_exec_t /sbin/kpartx
Current state: # ls -Z /sbin/kpartx -rwxr-xr-x root root system_u:object_r:sbin_t:SystemLow /sbin/kpartx # matchpathcon /sbin/kpartx /sbn/kpartx system_u:object_r:sbin_t:SystemLow #
# chcon -t lvm_exec_t /sbin/kpartx # ls -Z /sbin/kpartx -rwxr-xr-x root root system_u:object_r:lvm_exec_t:SystemLow /sbin/kpartx # setenforce 0 # kpartx -v /dev/sda sda1 : 0 208782 /dev/sda 63 sda2 : 0 488183220 /dev/sda 208845 # setenforce 1 # kpartx -v /dev/sda failed to stat() /dev/sda #
# setenforce 1 # semodule -DB # kpartx -v /dev/sda failed to stat() /dev/sda # ausearch -m avc -m user_avc -ts recent ---- time->Thu May 12 03:23:44 2011 type=SYSCALL msg=audit(1305185024.393:194): arch=c000003e syscall=4 success=no exit=-13 a0=7fff915ddd99 a1=7fff915dc700 a2=7fff915dc700 a3=0 items=0 ppid=3647pid=3754 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS1 ses=2 comm="kpartx" exe="/sbin/kpartx" subj=root:sysadm_r:lvm_t:s0-s15c0.c1023 key=(null) type=AVC msg=audit(1305185024.393:194): avc: denied { getattr } for pid=3754 comm="kpartx" path="/dev/sda" dev=tmpfs ino=1142 scontext=root:sysadm_r:lvm_t:s0-s15:c0.c1023 tcontext=system_u:object_r:fixed_disk_device_t:s15:c0.c1023 tclass=blk_file ----
AFAIK we have the same issue in RHEL6?
It is fixed already. Here is the bug report: https://bugzilla.redhat.com/show_bug.cgi?id=681887
I need to backport /sbin/kpartx -- gen_context(system_u:object_r:lvm_exec_t,s0) mls_file_read_all_levels(lvm_t) mls_file_upgrade(lvm_t) and probably other lvm fixes which have been done in RHEL6.
Yes
Fixed in selinux-policy-2.4.6-306.el5
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-1069.html