linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] psi: do not require setsched permission from the trigger creator
@ 2019-07-29 19:42 Suren Baghdasaryan
  2019-07-29 19:56 ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Suren Baghdasaryan @ 2019-07-29 19:42 UTC (permalink / raw)
  To: gregkh
  Cc: lizefan, hannes, axboe, dennis, dennisszhou, mingo, peterz, akpm,
	linux-mm, linux-doc, linux-kernel, kernel-team,
	Suren Baghdasaryan, Nick Kralevich

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@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 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 7acc632c3b82..ed9a1d573cb1 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);
-- 
2.22.0.709.g102302147b-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH 1/1] psi: do not require setsched permission from the trigger creator
@ 2019-07-30  1:33 Suren Baghdasaryan
  2019-07-30  8:11 ` Peter Zijlstra
  0 siblings, 1 reply; 10+ messages in thread
From: Suren Baghdasaryan @ 2019-07-30  1:33 UTC (permalink / raw)
  To: mingo, peterz
  Cc: lizefan, hannes, axboe, dennis, dennisszhou, akpm, linux-mm,
	linux-doc, linux-kernel, kernel-team, Suren Baghdasaryan,
	Nick Kralevich

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@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 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 7acc632c3b82..ed9a1d573cb1 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);
-- 
2.22.0.709.g102302147b-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-02  1:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 19:42 [PATCH 1/1] psi: do not require setsched permission from the trigger creator Suren Baghdasaryan
2019-07-29 19:56 ` Greg KH
2019-07-29 20:11   ` Suren Baghdasaryan
2019-07-30  1:33 Suren Baghdasaryan
2019-07-30  8:11 ` Peter Zijlstra
2019-07-30 17:44   ` Suren Baghdasaryan
2019-08-01  9:51     ` Peter Zijlstra
2019-08-01 18:28       ` Suren Baghdasaryan
2019-08-01 21:59         ` Peter Zijlstra
2019-08-02  1:19           ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).