Skip to contentSkip to conversation

psi: do not require setsched permission from the trigger creator

PATCH In review Suren Baghdasaryan 2 participants 3 messages Jul 29, 2019

Subsystems (4)
lore
Share & tools
lore

Suren Baghdasaryan

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 kernel/sched/psi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/psi.c +1 -1
index 7acc632c3b82..ed9a1d573cb1 100644
@@ -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);
Signature · 1 line
2.22.0.709.g102302147b-goog
#1 lore raw
Quoted 8 lines · Suren Baghdasaryan

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.

Quoted 5 lines
---
 kernel/sched/psi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
$ ./scripts/get_maintainer.pl --file kernel/sched/psi.c
Ingo Molnar <[email protected]> (maintainer:SCHEDULER)
Peter Zijlstra <[email protected]> (maintainer:SCHEDULER)
[email protected] (open list:SCHEDULER)

No where am I listed there, so why did you send this "To:" me?

please fix up and resend.

greg k-h

author maintainer
#2 lore raw
Quoted 16 lines · Greg KH
Quoted 8 lines · Suren Baghdasaryan

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.

Quoted 5 lines
---
 kernel/sched/psi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
$ ./scripts/get_maintainer.pl --file kernel/sched/psi.c
Ingo Molnar <[email protected]> (maintainer:SCHEDULER)
Peter Zijlstra <[email protected]> (maintainer:SCHEDULER)
[email protected] (open list:SCHEDULER)

No where am I listed there, so why did you send this "To:" me?

Oh, sorry about that. Both Ingo and Peter are CC'ed directly. Should I still resend?

Quoted 3 lines

please fix up and resend.

greg k-h