[lvc-project] [PATCH v2] rcu: Fix buffer overlow in print_cpu_stall_info()
Steven Rostedt
rostedt at goodmis.org
Mon Apr 1 22:05:40 MSK 2024
On Mon, 1 Apr 2024 21:54:54 +0300
Nikita Kiryushin <kiryushin at ancud.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
More information about the lvc-project
mailing list