aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index ab114ba37..66a980fcf 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1419,6 +1419,23 @@ out_unlock:
return ret;
}
+static int cpuset_allow_attach(struct cgroup *cgrp,
+ struct cgroup_taskset *tset)
+{
+ const struct cred *cred = current_cred(), *tcred;
+ struct task_struct *task;
+
+ cgroup_taskset_for_each(task, cgrp, tset) {
+ tcred = __task_cred(task);
+
+ if ((current != task) && !capable(CAP_SYS_ADMIN) &&
+ cred->euid != tcred->uid && cred->euid != tcred->suid)
+ return -EACCES;
+ }
+
+ return 0;
+}
+
static void cpuset_cancel_attach(struct cgroup *cgrp,
struct cgroup_taskset *tset)
{
@@ -1982,6 +1999,7 @@ struct cgroup_subsys cpuset_subsys = {
.css_offline = cpuset_css_offline,
.css_free = cpuset_css_free,
.can_attach = cpuset_can_attach,
+ .allow_attach = cpuset_allow_attach,
.cancel_attach = cpuset_cancel_attach,
.attach = cpuset_attach,
.subsys_id = cpuset_subsys_id,