Bug 700538

Summary: MLS - cgconfigparser cannot search on /cgroup/ dirs
Product: Red Hat Enterprise Linux 6 Reporter: Eduard Benes <ebenes>
Component: kernelAssignee: Eric Paris <eparis>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.1CC: dwalsh, eparis, iboverma, jburke, jsafrane, jwest, kzhang, mgrepl, mmalik, sgrubb
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.32-158.el6 Doc Type: Bug Fix
Doc Text:
When using certain SELinux policies, such as the MLS policy, it was not possible to properly mount the cgroupfs file system due to the way security checks were applied to the new cgroupfs inodes during the mount operation. With this update, the security checks applied during the mount operation have been changed so that they always succeed, and the cgroupfs file system can now be successfully mounted and used with the MLS SELinux policy. This issue did not affect systems which used the default targeted policy.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 13:20:25 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:
Bug Depends On:    
Bug Blocks: 584498, 682670, 705057, 713135, 846801, 846802    

Description Eduard Benes 2011-04-28 15:51:48 UTC
Description of problem:
Found following AVC denials for cgroups after (re)boot of my CCC system in MLS mode on latest 6.1 tree. Not sure about how this affects functionality of cgroups.

# cat cgroup.log | ausearch -i
----
type=AVC msg=audit(04/28/2011 08:41:26.404:6) : avc:  denied  { search } for  pid=918 comm=cgconfigparser name=/ dev=cgroup ino=10217 scontext=system_u:system_r:cgconfig_t:s0-s15:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s15:c0.c1023 tclass=dir 
type=SYSCALL msg=audit(04/28/2011 08:41:26.404:6) : arch=x86_64 syscall=mount success=yes exit=0 a0=7f1a3188b481 a1=7f1a31a8f400 a2=7f1a3188b481 a3=0 items=0 ppid=917 pid=918 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cgconfigparser exe=/sbin/cgconfigparser subj=system_u:system_r:cgconfig_t:s0-s15:c0.c1023 key=(null) 
----
type=AVC msg=audit(04/28/2011 08:41:26.404:7) : avc:  denied  { search } for  pid=918 comm=cgconfigparser name=/ dev=cgroup ino=10218 scontext=system_u:system_r:cgconfig_t:s0-s15:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s15:c0.c1023 tclass=dir 
type=SYSCALL msg=audit(04/28/2011 08:41:26.404:7) : arch=x86_64 syscall=mount success=yes exit=0 a0=7f1a3188b481 a1=7f1a31a91404 a2=7f1a3188b481 a3=0 items=0 ppid=917 pid=918 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cgconfigparser exe=/sbin/cgconfigparser subj=system_u:system_r:cgconfig_t:s0-s15:c0.c1023 key=(null) 
----
...

Searching for the inode numbers shows that the cgconfigparser wants to search for dirs under /cgroup/ which are for some to me unknown reason unlabeled_t at the time it does the search, though it they have the labels set correctly:

# ll -Z /cgroup/
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow blkio
drwxr-xr-x. eal  root system_u:object_r:cgroup_t:SystemLow cpu
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow cpuacct
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow cpuset
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow devices
drwxr-xr-x. eal  root system_u:object_r:cgroup_t:SystemLow freezer
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow memory
drwxr-xr-x. root root system_u:object_r:cgroup_t:SystemLow net_cls

Version-Release number of selected component (if applicable):
# rpm -q selinux-policy libcgroup
selinux-policy-3.7.19-87.el6.noarch
libcgroup-0.37-2.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. configure CCC system in MLS mode
2. (re)boot
3. check for AVCs in audit.log
  
Actual results:
avc denials

Expected results:
no avc denials :)

Additional info:
#============= cgconfig_t ==============
#!!!! This avc is a constraint violation.  You will need to add an attribute to either the source or target type to make it work.
#Contraint rule: 
allow cgconfig_t unlabeled_t:dir search;

Comment 1 Eduard Benes 2011-04-28 17:25:17 UTC
By any chance, could be a bug in kernel? Looks like it is not labelled correctly after the mount.

Comment 2 Eric Paris 2011-04-28 17:52:00 UTC
Do you see anything about selinux in dmesg or do you see anything from ausearch -m SELINUX_ERR ??

Comment 4 Eduard Benes 2011-04-29 07:51:28 UTC
(In reply to comment #2)
> Do you see anything about selinux in dmesg or do you see anything from ausearch
> -m SELINUX_ERR ??

No, there is nothing suspicious in dmesg or audit.log.

Comment 5 Eric Paris 2011-06-03 22:18:45 UTC
http://marc.info/?t=130635979000004&r=1&w=2

Comment 8 Aristeu Rozanski 2011-06-15 17:11:02 UTC
Patch(es) available on kernel-2.6.32-158.el6

Comment 10 Martin Prpič 2011-07-12 11:36:21 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When using certain SELinux policies, such as the MLS policy, it was not possible to properly mount the cgroupfs file system due to the way security checks were applied to the new cgroupfs inodes during the mount operation. With this update, the security checks applied during the mount operation have been changed so that they always succeed, and the cgroupfs file system can now be successfully mounted and used with the MLS SELinux policy. This issue did not affect systems which used the default targeted policy.

Comment 12 Mike Gahagan 2011-10-19 16:05:29 UTC
Confirmed libcgroup services can start on snap 2 with no denials, /cgroup mountpoints are now correctly labeled.

Comment 13 errata-xmlrpc 2011-12-06 13:20:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1530.html