diff options
author | Rom Lemarchand <romlem@android.com> | 2014-11-07 12:48:17 -0800 |
---|---|---|
committer | Ruchi Kandoi <kandoiruchi@google.com> | 2015-02-04 14:10:07 -0800 |
commit | 16474253cb671233c662ad89a88fee802dc36e15 (patch) | |
tree | d87c73b3fd8a1bf5d4451e0ff4669460f4a216d8 /include | |
parent | 3cf53d82e2a77a2c23ccfda7fa1f0d5646bda67e (diff) |
cgroup: refactor allow_attach function into common code
move cpu_cgroup_allow_attach to a common subsys_cgroup_allow_attach.
This allows any process with CAP_SYS_NICE to move tasks across cgroups if
they use this function as their allow_attach handler.
Bug: 18260435
Change-Id: I6bb4933d07e889d0dc39e33b4e71320c34a2c90f
Signed-off-by: Rom Lemarchand <romlem@android.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 1d5196889048..2deb0a95f1e5 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -911,6 +911,17 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, struct cgroup_subsys *ss); +/* + * Default Android check for whether the current process is allowed to move a + * task across cgroups, either because CAP_SYS_NICE is set or because the uid + * of the calling process is the same as the moved task or because we are + * running as root. + * Returns 0 if this is allowed, or -EACCES otherwise. + */ +int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css, + struct cgroup_taskset *tset); + + #else /* !CONFIG_CGROUPS */ static inline int cgroup_init_early(void) { return 0; } @@ -932,6 +943,11 @@ static inline int cgroup_attach_task_all(struct task_struct *from, return 0; } +static inline int subsys_cgroup_allow_attach(struct cgroup_subsys_state *css, + struct cgroup_taskset *tset) +{ + return 0; +} #endif /* !CONFIG_CGROUPS */ #endif /* _LINUX_CGROUP_H */ |