public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Liu Song <fishland@aliyun.com>
Cc: josh@joshtriplett.org, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
	linux-kernel@vger.kernel.org, liu.song11@zte.com.cn
Subject: Re: [PATCH] rcu: module param kthread_prio should set to read-only under sysfs
Date: Thu, 21 Feb 2019 07:45:31 -0800	[thread overview]
Message-ID: <20190221154531.GY11787@linux.ibm.com> (raw)
In-Reply-To: <20190221141327.3058-1-fishland@aliyun.com>

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. */
 


           reply	other threads:[~2019-02-21 15:46 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20190221141327.3058-1-fishland@aliyun.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190221154531.GY11787@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=fishland@aliyun.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.song11@zte.com.cn \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox