[tip:sched/urgent] sched/psi: Do not require setsched permission from the trigger creator

From: tip-bot for Suren Baghdasaryan
Date: Tue Aug 06 2019 - 07:21:12 EST


Commit-ID: 04e048cf09d7b5fc995817cdc5ae1acd4482429c
Gitweb: https://git.kernel.org/tip/04e048cf09d7b5fc995817cdc5ae1acd4482429c
Author: Suren Baghdasaryan <surenb@xxxxxxxxxx>
AuthorDate: Mon, 29 Jul 2019 18:33:10 -0700
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitDate: Tue, 6 Aug 2019 12:49:18 +0200

sched/psi: Do not require setsched permission from the trigger creator

When a process creates a new trigger by writing into /proc/pressure/*
files, permissions to write such a file should be used to determine whether
the process is allowed to do so or not. Current implementation would also
require such a process to have setsched capability. Setting of psi trigger
thread's scheduling policy is an implementation detail and should not be
exposed to the user level. Remove the permission check by using _nocheck
version of the function.

Suggested-by: Nick Kralevich <nnk@xxxxxxxxxx>
Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: lizefan@xxxxxxxxxx
Cc: mingo@xxxxxxxxxx
Cc: akpm@xxxxxxxxxxxxxxxxxxxx
Cc: kernel-team@xxxxxxxxxxx
Cc: dennisszhou@xxxxxxxxx
Cc: dennis@xxxxxxxxxx
Cc: hannes@xxxxxxxxxxx
Cc: axboe@xxxxxxxxx
Link: https://lkml.kernel.org/r/20190730013310.162367-1-surenb@xxxxxxxxxx
---
kernel/sched/psi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 7fe2c5fd26b5..23fbbcc414d5 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1061,7 +1061,7 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group,
mutex_unlock(&group->trigger_lock);
return ERR_CAST(kworker);
}
- sched_setscheduler(kworker->task, SCHED_FIFO, &param);
+ sched_setscheduler_nocheck(kworker->task, SCHED_FIFO, &param);
kthread_init_delayed_work(&group->poll_work,
psi_poll_work);
rcu_assign_pointer(group->poll_kworker, kworker);