#include <linux/eventfd.h>
#include <linux/poll.h>
#include <linux/flex_array.h> /* used in cgroup_attach_proc */
-#include <linux/capability.h>
#include <asm/atomic.h>
failed_ss = ss;
goto out;
}
- } else if (!capable(CAP_SYS_ADMIN)) {
- const struct cred *cred = current_cred(), *tcred;
-
- /* No can_attach() - check perms generically */
- tcred = __task_cred(tsk);
- if (cred->euid != tcred->uid &&
- cred->euid != tcred->suid) {
- return -EACCES;
- }
}
if (ss->can_attach_task) {
retval = ss->can_attach_task(cgrp, tsk);
{
struct freezer *freezer;
- if ((current != task) && (!capable(CAP_SYS_ADMIN))) {
- const struct cred *cred = current_cred(), *tcred;
-
- tcred = __task_cred(task);
- if (cred->euid != tcred->uid && cred->euid != tcred->suid)
- return -EPERM;
- }
-
/*
* Anything frozen can't move or be moved to/from.
*/
{
struct cpuset *cs = cgroup_cs(cont);
- if ((current != task) && (!capable(CAP_SYS_ADMIN))) {
- const struct cred *cred = current_cred(), *tcred;
-
- if (cred->euid != tcred->uid && cred->euid != tcred->suid)
- return -EPERM;
- }
-
if (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
return -ENOSPC;
static int
cpu_cgroup_can_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
{
- if ((current != tsk) && (!capable(CAP_SYS_NICE))) {
- const struct cred *cred = current_cred(), *tcred;
-
- tcred = __task_cred(tsk);
-
- if (cred->euid != tcred->uid && cred->euid != tcred->suid)
- return -EPERM;
- }
-
#ifdef CONFIG_RT_GROUP_SCHED
if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk))
return -EINVAL;