diff options
author | John Stultz <john.stultz@linaro.org> | 2017-09-07 11:47:17 -0700 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2024-05-27 15:25:02 +0530 |
commit | ae9edb13d11de5d6d6f69c6c90c6e7f496064f7d (patch) | |
tree | 8db3d29cd4d768f271b7d04bb55f22c30dc9b50c /kernel | |
parent | 113575aa494a9598d06d0c2b344ce22ed45c845f (diff) |
ANDROID: Allow CAP_SYS_NICE tasks to migrate processes between cgroups
This hack allows CAP_SYS_NICE tasks to have privledge
to migrate other tasks between cgroups. This is used by
the system_service to migrate processes between top-app,
foreground, background cgroups for cputime and schedtune
groups.
Fixes following libprocessgroup error loop in logcat:
-----------
E libprocessgroup: AddTidToCgroup failed to write '$ABCD'; fd=$XYZ: Permission denied
E libprocessgroup: Failed to add task into cgroup
-----------
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup/cgroup-v1.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 520a11cb12f4..ee884c6fba82 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -513,7 +513,8 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, tcred = get_task_cred(task); if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && !uid_eq(cred->euid, tcred->uid) && - !uid_eq(cred->euid, tcred->suid)) + !uid_eq(cred->euid, tcred->suid) && + !ns_capable(tcred->user_ns, CAP_SYS_NICE)) ret = -EACCES; put_cred(tcred); if (ret) |