All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
@ 2024-03-26 17:48 Nikita Kiryushin
  2024-03-26 18:06 ` Paul E. McKenney
  2024-03-26 19:22 ` Steven Rostedt
  0 siblings, 2 replies; 11+ messages in thread
From: Nikita Kiryushin @ 2024-03-26 17:48 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Nikita Kiryushin, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu, linux-kernel,
	lvc-project

There is a possibility of buffer overflow in
show_rcu_tasks_trace_gp_kthread() if counters, passed
to sprintf() are huge. Counter numbers, needed for this
are unrealistically high, but buffer overflow is still
possible.

Update used buffer size for maximum needed size for
current format string.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 147b5945d67a..13ac514489c0 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1992,7 +1992,7 @@ static int __init rcu_spawn_tasks_trace_kthread(void)
 #if !defined(CONFIG_TINY_RCU)
 void show_rcu_tasks_trace_gp_kthread(void)
 {
-	char buf[64];
+	char buf[87];
 
 	sprintf(buf, "N%lu h:%lu/%lu/%lu",
 		data_race(n_trc_holdouts),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-26 17:48 [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Nikita Kiryushin
@ 2024-03-26 18:06 ` Paul E. McKenney
  2024-03-26 19:22 ` Steven Rostedt
  1 sibling, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2024-03-26 18:06 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
	Josh Triplett, Boqun Feng, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Tue, Mar 26, 2024 at 08:48:39PM +0300, Nikita Kiryushin wrote:
> There is a possibility of buffer overflow in
> show_rcu_tasks_trace_gp_kthread() if counters, passed
> to sprintf() are huge. Counter numbers, needed for this
> are unrealistically high, but buffer overflow is still
> possible.
> 
> Update used buffer size for maximum needed size for
> current format string.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
> Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>

Good catch!  Applied for testing and further review.

							Thanx, Paul

> ---
>  kernel/rcu/tasks.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 147b5945d67a..13ac514489c0 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -1992,7 +1992,7 @@ static int __init rcu_spawn_tasks_trace_kthread(void)
>  #if !defined(CONFIG_TINY_RCU)
>  void show_rcu_tasks_trace_gp_kthread(void)
>  {
> -	char buf[64];
> +	char buf[87];
>  
>  	sprintf(buf, "N%lu h:%lu/%lu/%lu",
>  		data_race(n_trc_holdouts),
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-26 17:48 [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Nikita Kiryushin
  2024-03-26 18:06 ` Paul E. McKenney
@ 2024-03-26 19:22 ` Steven Rostedt
  2024-03-26 19:55   ` Nikita Kiryushin
  2024-03-27 16:36   ` [PATCH v2] " Nikita Kiryushin
  1 sibling, 2 replies; 11+ messages in thread
From: Steven Rostedt @ 2024-03-26 19:22 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Tue, 26 Mar 2024 20:48:39 +0300
Nikita Kiryushin <kiryushin@ancud.ru> wrote:

> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 147b5945d67a..13ac514489c0 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -1992,7 +1992,7 @@ static int __init rcu_spawn_tasks_trace_kthread(void)
>  #if !defined(CONFIG_TINY_RCU)
>  void show_rcu_tasks_trace_gp_kthread(void)
>  {
> -	char buf[64];
> +	char buf[87];

Why 87? as it's not even word size, and this is on the stack.

>  
>  	sprintf(buf, "N%lu h:%lu/%lu/%lu",

Better yet, why not just use snprintf()?

	snprintf(buf, 64, "N%lu h:%lu/%lu/%lu",

-- Steve

>  		data_race(n_trc_holdouts),
> -- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-26 19:22 ` Steven Rostedt
@ 2024-03-26 19:55   ` Nikita Kiryushin
  2024-03-26 20:28     ` Steven Rostedt
  2024-03-27 16:36   ` [PATCH v2] " Nikita Kiryushin
  1 sibling, 1 reply; 11+ messages in thread
From: Nikita Kiryushin @ 2024-03-26 19:55 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project



On 3/26/24 22:22, Steven Rostedt wrote:
> Why 87? as it's not even word size, and this is on the stack.
>
Got 87 as maximal used buffer length (result of
sprintf(buf, "N%lu h:%lu/%lu/%lu",
         (unsigned long int) -1,
         (unsigned long int) -1,
         (unsigned long int) -1,
         (unsigned long int) -1);
+1 for terminator.

Is word-size alignment a thing in this case? I thought that char buffers
are ok to be aligned by 1?
> Better yet, why not just use snprintf()?
>
Seems like a better idea indeed, as if fixes overflows for unpractical cases,
without added overhead to common cases. The only concern is possible truncation
of data, that may break some automation (if output is parsed by someone,
without accounting on it being cut, who knows). But again, it is for pretty unpractical
values.

Will make a v2 patch with snprintf() with buffer length.

Genuinely look forward to being educated about aspects of aligning array sizes, as
I do not really understand the limitations.

Thanks!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-26 19:55   ` Nikita Kiryushin
@ 2024-03-26 20:28     ` Steven Rostedt
  0 siblings, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2024-03-26 20:28 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Tue, 26 Mar 2024 22:55:29 +0300
Nikita Kiryushin <kiryushin@ancud.ru> wrote:

> On 3/26/24 22:22, Steven Rostedt wrote:
> > Why 87? as it's not even word size, and this is on the stack.
> >  
> Got 87 as maximal used buffer length (result of
> sprintf(buf, "N%lu h:%lu/%lu/%lu",
>          (unsigned long int) -1,
>          (unsigned long int) -1,
>          (unsigned long int) -1,
>          (unsigned long int) -1);
> +1 for terminator.
> 
> Is word-size alignment a thing in this case? I thought that char buffers
> are ok to be aligned by 1?

Because it's on the stack, which will likely reserve data in word size.

Thus, buf[87] reserves as much data on the stack as buf[88].


> > Better yet, why not just use snprintf()?
> >  
> Seems like a better idea indeed, as if fixes overflows for unpractical cases,
> without added overhead to common cases. The only concern is possible truncation
> of data, that may break some automation (if output is parsed by someone,
> without accounting on it being cut, who knows). But again, it is for pretty unpractical
> values.
> 
> Will make a v2 patch with snprintf() with buffer length.
> 
> Genuinely look forward to being educated about aspects of aligning array sizes, as
> I do not really understand the limitations.

It's because it's on the stack, but it's always good to align. For
instance, kmalloc() will allocate things in 32 byte chunks.

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-26 19:22 ` Steven Rostedt
  2024-03-26 19:55   ` Nikita Kiryushin
@ 2024-03-27 16:36   ` Nikita Kiryushin
  2024-03-27 16:46     ` [PATCH v3] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
  2024-03-27 16:51     ` [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Steven Rostedt
  1 sibling, 2 replies; 11+ messages in thread
From: Nikita Kiryushin @ 2024-03-27 16:36 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Nikita Kiryushin, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu, linux-kernel,
	lvc-project

There is a possibility of buffer overflow in
show_rcu_tasks_trace_gp_kthread() if counters, passed
to sprintf() are huge. Counter numbers, needed for this
are unrealistically high, but buffer overflow is still
possible.

Use snprintf() with buffer size instead of sprintf().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
v2: Use snprintf() as
Steven Rostedt <rostedt@goodmis.org> suggested.
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 147b5945d67a..963ecae3c8e6 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
 {
 	char buf[64];
 
-	sprintf(buf, "N%lu h:%lu/%lu/%lu",
+	snprintf(buf, ARRAY_SIZE(buf), "N%lu h:%lu/%lu/%lu",
 		data_race(n_trc_holdouts),
 		data_race(n_heavy_reader_ofl_updates),
 		data_race(n_heavy_reader_updates),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow
  2024-03-27 16:36   ` [PATCH v2] " Nikita Kiryushin
@ 2024-03-27 16:46     ` Nikita Kiryushin
  2024-03-27 16:51     ` [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Steven Rostedt
  1 sibling, 0 replies; 11+ messages in thread
From: Nikita Kiryushin @ 2024-03-27 16:46 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Nikita Kiryushin, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu, linux-kernel,
	lvc-project

There is a possibility of buffer overflow in
show_rcu_tasks_trace_gp_kthread() if counters, passed
to sprintf() are huge. Counter numbers, needed for this
are unrealistically high, but buffer overflow is still
possible.

Use snprintf() with buffer size instead of sprintf().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
v3: Fixed commit message
v2: Use snprintf() as
Steven Rostedt <rostedt@goodmis.org> suggested.
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 147b5945d67a..963ecae3c8e6 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
 {
 	char buf[64];
 
-	sprintf(buf, "N%lu h:%lu/%lu/%lu",
+	snprintf(buf, ARRAY_SIZE(buf), "N%lu h:%lu/%lu/%lu",
 		data_race(n_trc_holdouts),
 		data_race(n_heavy_reader_ofl_updates),
 		data_race(n_heavy_reader_updates),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size
  2024-03-27 16:36   ` [PATCH v2] " Nikita Kiryushin
  2024-03-27 16:46     ` [PATCH v3] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
@ 2024-03-27 16:51     ` Steven Rostedt
  2024-03-27 17:47       ` [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2024-03-27 16:51 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Wed, 27 Mar 2024 19:36:56 +0300
Nikita Kiryushin <kiryushin@ancud.ru> wrote:

> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 147b5945d67a..963ecae3c8e6 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
>  {
>  	char buf[64];
>  
> -	sprintf(buf, "N%lu h:%lu/%lu/%lu",
> +	snprintf(buf, ARRAY_SIZE(buf), "N%lu h:%lu/%lu/%lu",

Nit, but I would have used sizeof(buf) instead of ARRAY_SIZE(buf) as that's
more common practice for this type of code.

[ do a: git grep 'sizeof(buf)' ]

-- Steve

>  		data_race(n_trc_holdouts),
>  		data_race(n_heavy_reader_ofl_updates),
>  		data_race(n_heavy_reader_updates),

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow
  2024-03-27 16:51     ` [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Steven Rostedt
@ 2024-03-27 17:47       ` Nikita Kiryushin
  2024-03-27 17:52         ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Nikita Kiryushin @ 2024-03-27 17:47 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Nikita Kiryushin, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu, linux-kernel,
	lvc-project

There is a possibility of buffer overflow in
show_rcu_tasks_trace_gp_kthread() if counters, passed
to sprintf() are huge. Counter numbers, needed for this
are unrealistically high, but buffer overflow is still
possible.

Use snprintf() with buffer size instead of sprintf().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
v4: Change ARRAY_SIZE to sizeof() as more idiomatic
as Steven Rostedt <rostedt@goodmis.org> suggested
v3: Fixed commit message
v2: Use snprintf() as
Steven Rostedt <rostedt@goodmis.org> suggested.
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 147b5945d67a..2a453de9f3d9 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
 {
 	char buf[64];
 
-	sprintf(buf, "N%lu h:%lu/%lu/%lu",
+	snprintf(buf, sizeof(buf), "N%lu h:%lu/%lu/%lu",
 		data_race(n_trc_holdouts),
 		data_race(n_heavy_reader_ofl_updates),
 		data_race(n_heavy_reader_updates),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow
  2024-03-27 17:47       ` [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
@ 2024-03-27 17:52         ` Steven Rostedt
  2024-03-27 18:31           ` Paul E. McKenney
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2024-03-27 17:52 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Wed, 27 Mar 2024 20:47:47 +0300
Nikita Kiryushin <kiryushin@ancud.ru> wrote:

> There is a possibility of buffer overflow in
> show_rcu_tasks_trace_gp_kthread() if counters, passed
> to sprintf() are huge. Counter numbers, needed for this
> are unrealistically high, but buffer overflow is still
> possible.
> 
> Use snprintf() with buffer size instead of sprintf().
> 

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
> Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
> ---
> v4: Change ARRAY_SIZE to sizeof() as more idiomatic
> as Steven Rostedt <rostedt@goodmis.org> suggested
> v3: Fixed commit message
> v2: Use snprintf() as
> Steven Rostedt <rostedt@goodmis.org> suggested.
>  kernel/rcu/tasks.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 147b5945d67a..2a453de9f3d9 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
>  {
>  	char buf[64];
>  
> -	sprintf(buf, "N%lu h:%lu/%lu/%lu",
> +	snprintf(buf, sizeof(buf), "N%lu h:%lu/%lu/%lu",
>  		data_race(n_trc_holdouts),
>  		data_race(n_heavy_reader_ofl_updates),
>  		data_race(n_heavy_reader_updates),


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow
  2024-03-27 17:52         ` Steven Rostedt
@ 2024-03-27 18:31           ` Paul E. McKenney
  0 siblings, 0 replies; 11+ messages in thread
From: Paul E. McKenney @ 2024-03-27 18:31 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Nikita Kiryushin, Frederic Weisbecker, Neeraj Upadhyay,
	Joel Fernandes, Josh Triplett, Boqun Feng, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, rcu, linux-kernel, lvc-project

On Wed, Mar 27, 2024 at 01:52:46PM -0400, Steven Rostedt wrote:
> On Wed, 27 Mar 2024 20:47:47 +0300
> Nikita Kiryushin <kiryushin@ancud.ru> wrote:
> 
> > There is a possibility of buffer overflow in
> > show_rcu_tasks_trace_gp_kthread() if counters, passed
> > to sprintf() are huge. Counter numbers, needed for this
> > are unrealistically high, but buffer overflow is still
> > possible.
> > 
> > Use snprintf() with buffer size instead of sprintf().
> > 
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Queued and pushed, thank you both!

							Thanx, Paul

> -- Steve
> 
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> > 
> > Fixes: edf3775f0ad6 ("rcu-tasks: Add count for idle tasks on offline CPUs")
> > Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
> > ---
> > v4: Change ARRAY_SIZE to sizeof() as more idiomatic
> > as Steven Rostedt <rostedt@goodmis.org> suggested
> > v3: Fixed commit message
> > v2: Use snprintf() as
> > Steven Rostedt <rostedt@goodmis.org> suggested.
> >  kernel/rcu/tasks.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > index 147b5945d67a..2a453de9f3d9 100644
> > --- a/kernel/rcu/tasks.h
> > +++ b/kernel/rcu/tasks.h
> > @@ -1994,7 +1994,7 @@ void show_rcu_tasks_trace_gp_kthread(void)
> >  {
> >  	char buf[64];
> >  
> > -	sprintf(buf, "N%lu h:%lu/%lu/%lu",
> > +	snprintf(buf, sizeof(buf), "N%lu h:%lu/%lu/%lu",
> >  		data_race(n_trc_holdouts),
> >  		data_race(n_heavy_reader_ofl_updates),
> >  		data_race(n_heavy_reader_updates),
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-03-27 18:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 17:48 [PATCH] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Nikita Kiryushin
2024-03-26 18:06 ` Paul E. McKenney
2024-03-26 19:22 ` Steven Rostedt
2024-03-26 19:55   ` Nikita Kiryushin
2024-03-26 20:28     ` Steven Rostedt
2024-03-27 16:36   ` [PATCH v2] " Nikita Kiryushin
2024-03-27 16:46     ` [PATCH v3] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
2024-03-27 16:51     ` [PATCH v2] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Steven Rostedt
2024-03-27 17:47       ` [PATCH v4] rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow Nikita Kiryushin
2024-03-27 17:52         ` Steven Rostedt
2024-03-27 18:31           ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.