diff options
| author | Rom Lemarchand <romlem@android.com> | 2014-11-07 12:48:17 -0800 |
|---|---|---|
| committer | John Stultz <john.stultz@linaro.org> | 2016-02-16 13:53:42 -0800 |
| commit | 6809864a2cc59332b246c183a2b78328f6aa551e (patch) | |
| tree | 2cc8352e9aec310ec205eb6468dd1c2f8b091eee /include/linux | |
| parent | 1f027b30b538458d50fa7a40d0ef0ddfed8cd3f2 (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/linux')
| -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 cb91b44f5f78..c08c83182e08 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -528,6 +528,17 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp) pr_cont_kernfs_path(cgrp->kn); } +/* + * 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 */ struct cgroup_subsys_state; @@ -552,6 +563,11 @@ static inline void cgroup_free(struct task_struct *p) {} static inline int cgroup_init_early(void) { return 0; } static inline int cgroup_init(void) { 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 */ |
