aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a3d1c8e43d34..d3d81b82e378 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3531,13 +3531,24 @@ recheck:
3531 if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) 3531 if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
3532 return -EINVAL; 3532 return -EINVAL;
3533 3533
3534 if ((policy == SCHED_FIFO || policy == SCHED_RR) && 3534 /*
3535 param->sched_priority > p->signal->rlim[RLIMIT_RTPRIO].rlim_cur && 3535 * Allow unprivileged RT tasks to decrease priority:
3536 !capable(CAP_SYS_NICE)) 3536 */
3537 return -EPERM; 3537 if (!capable(CAP_SYS_NICE)) {
3538 if ((current->euid != p->euid) && (current->euid != p->uid) && 3538 /* can't change policy */
3539 !capable(CAP_SYS_NICE)) 3539 if (policy != p->policy)
3540 return -EPERM; 3540 return -EPERM;
3541 /* can't increase priority */
3542 if (policy != SCHED_NORMAL &&
3543 param->sched_priority > p->rt_priority &&
3544 param->sched_priority >
3545 p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
3546 return -EPERM;
3547 /* can't change other user's priorities */
3548 if ((current->euid != p->euid) &&
3549 (current->euid != p->uid))
3550 return -EPERM;
3551 }
3541 3552
3542 retval = security_task_setscheduler(p, policy, param); 3553 retval = security_task_setscheduler(p, policy, param);
3543 if (retval) 3554 if (retval)