Skip to content

Commit d44753b

Browse files
jlelliIngo Molnar
authored andcommitted
sched/deadline: Deny unprivileged users to set/change SCHED_DEADLINE policy
Deny the use of SCHED_DEADLINE policy to unprivileged users. Even if root users can set the policy for normal users, we don't want the latter to be able to change their parameters (safest behavior). Signed-off-by: Juri Lelli <juri.lelli@gmail.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1393844961-18097-1-git-send-email-juri.lelli@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 8712a00 commit d44753b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/sched/core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,6 +3338,15 @@ static int __sched_setscheduler(struct task_struct *p,
33383338
return -EPERM;
33393339
}
33403340

3341+
/*
3342+
* Can't set/change SCHED_DEADLINE policy at all for now
3343+
* (safest behavior); in the future we would like to allow
3344+
* unprivileged DL tasks to increase their relative deadline
3345+
* or reduce their runtime (both ways reducing utilization)
3346+
*/
3347+
if (dl_policy(policy))
3348+
return -EPERM;
3349+
33413350
/*
33423351
* Treat SCHED_IDLE as nice 20. Only allow a switch to
33433352
* SCHED_NORMAL if the RLIMIT_NICE would normally permit it.

0 commit comments

Comments
 (0)