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

From: tip-bot for Juri Lelli
Date: Tue Mar 11 2014 - 08:37:29 EST


Commit-ID: d44753b843e093f9e1f2f14806fbe106fff74898
Gitweb: http://git.kernel.org/tip/d44753b843e093f9e1f2f14806fbe106fff74898
Author: Juri Lelli <juri.lelli@xxxxxxxxx>
AuthorDate: Mon, 3 Mar 2014 12:09:21 +0100
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
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).

Signed-off-by: Juri Lelli <juri.lelli@xxxxxxxxx>
Signed-off-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/1393844961-18097-1-git-send-email-juri.lelli@xxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
kernel/sched/core.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 6edbef2..f5c6635 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/