rcu: module param kthread_prio should set to read-only under sysfs
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · Liu Song
kthread_prioused to set prio for boost thread which spawn at the very beginning. We can seekthread_priounder sysfs, and it could be set to a new value. But boost thread's prio can not updated by this opreation. However, user can change boost thread prio by chrt.We better make
kthread_prioread-only under sysfs, which can avoid user invalid operation.Signed-off-by Liu Song <[email protected]>--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/rcu/tree.c +0
-0
kernel/rcu/tree.c static void sync_sched_exp_online_cleanup(int cpu); · line 162
Quoted 7 lines
kernel/rcu/tree.c +1
-1@@ -157,7 +157,7 @@ static void sync_sched_exp_online_cleanup(int cpu);/* rcuc/rcub kthread realtime priority */ static int kthread_prio =IS_ENABLED (CONFIG_RCU_BOOST ) ?1 :0 ; -module_param (kthread_prio, int,0644 ); +module_param (kthread_prio, int,0444 );/* Delay in jiffies for grace-period initialization delays, debug only. */
Good catch! I applied this with the commit log updated as shown below. Please let me know if I messed anything up.
Thanx, Paul
------------------------------------------------------------------------
commit c6e26d5eaa5794ae32b38cb1ced9495b07af4ff5
Author: Liu Song <[email protected]> Date: Thu Feb 21 22:13:27 2019 +0800
rcu: Set rcutree.kthread_prio sysfs access to read-only
The rcutree.kthread_prio kernel-boot parameter is used to set the priority for boost (rcub), per-CPU (rcuc), and grace-period (rcu_preempt or rcu_sched) kthreads. It is also used by rcutorture to check whether it is possible to meaningfully test RCU priority boosting. However, all of these cases will either ignore or be confused by any post-boot changes to rcutree.kthread_prio.
Note that the user really can change the priorities of all of these kthreads using chrt, given sufficient privileges. Therefore, the read-write nature of sysfs access to rcutree.kthread_prio is thus at best an attractive nuisance.
This commit therefore changes sysfs access to rcutree.kthread_prio to be read-only.
kernel/rcu/tree.c +1 -1
@@ -143,7 +143,7 @@ static void sync_sched_exp_online_cleanup(int cpu);/* rcuc/rcub kthread realtime priority */ static int kthread_prio =IS_ENABLED (CONFIG_RCU_BOOST ) ?1 :0 ; -module_param (kthread_prio, int,0644 ); +module_param (kthread_prio, int,0444 );/* Delay in jiffies for grace-period initialization delays, debug only. */