Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7d92b8f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpuset: Add allow_attach hook for cpusets on android."

parents bb5866bf c0001a25
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2075,12 +2075,30 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css)
	mutex_unlock(&cpuset_mutex);
}

static int cpuset_allow_attach(struct cgroup_taskset *tset)
{
	const struct cred *cred = current_cred(), *tcred;
	struct task_struct *task;
	struct cgroup_subsys_state *css;

	cgroup_taskset_for_each(task, css, tset) {
		tcred = __task_cred(task);

		if ((current != task) && !capable(CAP_SYS_ADMIN) &&
		     cred->euid.val != tcred->uid.val && cred->euid.val != tcred->suid.val)
			return -EACCES;
	}

	return 0;
}

struct cgroup_subsys cpuset_cgrp_subsys = {
	.css_alloc	= cpuset_css_alloc,
	.css_online	= cpuset_css_online,
	.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,
	.bind		= cpuset_bind,