[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240401150540.6dab14fc@gandalf.local.home>
Date: Mon, 1 Apr 2024 15:05:40 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Nikita Kiryushin <kiryushin@...ud.ru>
Cc: "Paul E. McKenney" <paulmck@...nel.org>, Frederic Weisbecker
<frederic@...nel.org>, Neeraj Upadhyay <quic_neeraju@...cinc.com>, Joel
Fernandes <joel@...lfernandes.org>, Josh Triplett <josh@...htriplett.org>,
Boqun Feng <boqun.feng@...il.com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Lai Jiangshan <jiangshanlai@...il.com>,
Zqiang <qiang.zhang1211@...il.com>, rcu@...r.kernel.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH v2] rcu: Fix buffer overlow in print_cpu_stall_info()
On Mon, 1 Apr 2024 21:54:54 +0300
Nikita Kiryushin <kiryushin@...ud.ru> wrote:
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -504,7 +504,8 @@ static void print_cpu_stall_info(int cpu)
> rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu));
> rcuc_starved = rcu_is_rcuc_kthread_starving(rdp, &j);
> if (rcuc_starved)
> - sprintf(buf, " rcuc=%ld jiffies(starved)", j);
> + /* %ld is intentional, for easier bug detection */
The above still has assumptions of what is going on for the reviewer.
I would suggest something a bit more obvious like:
/* Print signed value, as negative means it is likely a bug */
> + snprintf(buf, sizeof(buf), " rcuc=%ld jiffies(starved)", j);
> pr_err("\t%d-%c%c%c%c: (%lu %s) idle=%04x/%ld/%#lx softirq=%u/%u fqs=%ld%s%s\n",
-- Steve
Powered by blists - more mailing lists