prctl: adds the capable(CAP_SYS_NICE) check to PR_SET_TIMERSLACK_PID.
[firefly-linux-kernel-4.4.55.git] / kernel / sys.c
index 875529e936abae09b01082555edd9357a6001507..ab7fda5fbe188559fcb7924fa5944e8439c8e856 100644 (file)
@@ -2378,6 +2378,9 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
                                return -EINVAL;
                        break;
                case PR_SET_TIMERSLACK_PID:
+                       if (current->pid != (pid_t)arg3 &&
+                                       !capable(CAP_SYS_NICE))
+                               return -EPERM;
                        rcu_read_lock();
                        tsk = find_task_by_pid_ns((pid_t)arg3, &init_pid_ns);
                        if (tsk == NULL) {