Skip to contentSkip to conversation

sched/deadline: Normal users can't set/change SCHED_DEADLINE policy

PATCH New Juri Lelli 2 participants 2 messages Mar 3, 2014 – Mar 11, 2014 Scheduler

lore
Share & tools
lore

Juri Lelli

author
#0 lore raw

PATCH 1/1 sched/deadline: Normal users can't 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).

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 kernel/sched/core.c |    9 +++++++++
 1 file changed, 9 insertions(+)
kernel/sched/core.c +9 -0
index 6edbef2..dbed360 100644
@@ -3338,6 +3338,15 @@ recheck:
 				return -EPERM;
 		}
 
+		 /*
+		  * can't set/change SCHED_DEADLINE policy at all for now
+		  * (safest behavior); in the future we would like to allow
+		  * unprivileged DL tasks to increase their relative deadline
+		  * or reduce their runtime (both ways reducing utilization)
+		  */
+		if (dl_policy(policy))
+			return -EPERM;
+
 		/*
 		 * Treat SCHED_IDLE as nice 20. Only allow a switch to
 		 * SCHED_NORMAL if the RLIMIT_NICE would normally permit it.
Signature · 1 line
1.7.9.5
#1 lore raw

[tip:sched/core] sched/deadline: Deny unprivileged users to set/ change SCHED_DEADLINE policy

sched/deadline: Deny unprivileged users to set/change SCHED_DEADLINE policy
Commit-ID:  d44753b843e093f9e1f2f14806fbe106fff74898
Gitweb:     http://git.kernel.org/tip/d44753b843e093f9e1f2f14806fbe106fff74898
Author:     Juri Lelli <[email protected]>
AuthorDate: Mon, 3 Mar 2014 12:09:21 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 11 Mar 2014 11:33:46 +0100

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).

---
 kernel/sched/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
kernel/sched/core.c +9 -0
index 6edbef2..f5c6635 100644
@@ -3338,6 +3338,15 @@ recheck:
 				return -EPERM;
 		}
 
+		 /*
+		  * Can't set/change SCHED_DEADLINE policy at all for now
+		  * (safest behavior); in the future we would like to allow
+		  * unprivileged DL tasks to increase their relative deadline
+		  * or reduce their runtime (both ways reducing utilization)
+		  */
+		if (dl_policy(policy))
+			return -EPERM;
+
 		/*
 		 * Treat SCHED_IDLE as nice 20. Only allow a switch to
 		 * SCHED_NORMAL if the RLIMIT_NICE would normally permit it.