diff options
author | Colin Cross <ccross@android.com> | 2011-07-12 19:53:24 -0700 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2011-09-20 16:59:57 -0700 |
commit | 0c7fe33e5fe277ebc0676eca5143dc809bfac0a2 (patch) | |
tree | 6aca0637b89871b6daada25fd454e32202cf076e /include | |
parent | e475aef9ac0b788d05ed6dec0f839b49ae819591 (diff) |
cgroup: Add generic cgroup subsystem permission checks
Rather than using explicit euid == 0 checks when trying to move
tasks into a cgroup via CFS, move permission checks into each
specific cgroup subsystem. If a subsystem does not specify a
'allow_attach' handler, then we fall back to doing our checks
the old way.
Use the 'allow_attach' handler for the 'cpu' cgroup to allow
non-root processes to add arbitrary processes to a 'cpu' cgroup
if it has the CAP_SYS_NICE capability set.
This version of the patch adds a 'allow_attach' handler instead
of reusing the 'can_attach' handler. If the 'can_attach' handler
is reused, a new cgroup that implements 'can_attach' but not
the permission checks could end up with no permission checks
at all.
Change-Id: Icfa950aa9321d1ceba362061d32dc7dfa2c64f0c
Original-Author: San Mehat <san@google.com>
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index ac1140066bf..cefedc8ced9 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -459,6 +459,7 @@ struct cgroup_subsys { struct cgroup *cgrp); int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); + int (*allow_attach)(struct cgroup *cgrp, struct task_struct *tsk); int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, struct task_struct *tsk); int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk); |