linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] rcu: module param kthread_prio should set to read-only under sysfs
       [not found] <20190221141327.3058-1-fishland@aliyun.com>
@ 2019-02-21 15:45 ` Paul E. McKenney
  0 siblings, 0 replies; only message in thread
From: Paul E. McKenney @ 2019-02-21 15:45 UTC (permalink / raw)
  To: Liu Song
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, linux-kernel, liu.song11

On Thu, Feb 21, 2019 at 10:13:27PM +0800, Liu Song wrote:
> kthread_prio used to set prio for boost thread
> which spawn at the very beginning. We can see
> kthread_prio under 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_prio read-only under
> sysfs, which can avoid user invalid operation.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>
> ---
>  kernel/rcu/tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 121f833acd04..38faef424a99 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -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 <fishland@aliyun.com>
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.
    
    Signed-off-by: Liu Song <liu.song11@zte.com.cn>
    Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 24b07cf84161..7273ef0c278d 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -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. */
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-21 15:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190221141327.3058-1-fishland@aliyun.com>
2019-02-21 15:45 ` [PATCH] rcu: module param kthread_prio should set to read-only under sysfs Paul E. McKenney

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).