All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Report TP_printk double dereference with pr_warn()
@ 2026-08-06  5:07 David Carlier
  2026-08-06 21:41 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: David Carlier @ 2026-08-06  5:07 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-trace-kernel,
	linux-kernel, David Carlier

test_double_dereference() uses WARN_ONCE(), which is per-call-site. Only
the first offending event in the kernel is ever reported, and the tree
still has six: ice_{rx,tx}_dim_template, two hfi1 txq events, mtu3_ep and
edma_log_io. Whichever registers first hides the rest, and it taints the
kernel for what is a source-level mistake.

Use pr_warn() instead, matching the "TRACE EVENT ERROR:" report that
handle_dereference_arg() already emits for the same class of problem.
All offenders are now listed on one boot.

Fixes: b5cc230af5e5 ("tracing: Warn when an event dereferences a pointer in TP_printk()")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 kernel/trace/trace_events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a8590d2394e3..53f32752edc0 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -415,8 +415,8 @@ static void test_double_dereference(const char *str, int len,
 		ptr += 5;
 		for (; ptr < end; ptr++) {
 			if (ptr[0] == '-' && ptr[1] == '>') {
-				WARN_ONCE(1, "Event %s has double dereference in TP_printk: %.*s\n",
-					  trace_event_name(call), len, str);
+				pr_warn("TRACE EVENT ERROR: Event %s has double dereference in TP_printk: %.*s\n",
+					trace_event_name(call), len, str);
 				return;
 			}
 			if (!isalnum(*ptr) && *ptr != '_')
-- 
2.55.0


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

* Re: [PATCH] tracing: Report TP_printk double dereference with pr_warn()
  2026-08-06  5:07 [PATCH] tracing: Report TP_printk double dereference with pr_warn() David Carlier
@ 2026-08-06 21:41 ` Steven Rostedt
  2026-08-06 21:52   ` [PATCH v2] tracing: Report every TP_printk double dereference David Carlier
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2026-08-06 21:41 UTC (permalink / raw)
  To: David Carlier
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-trace-kernel,
	linux-kernel

On Thu,  6 Aug 2026 06:07:16 +0100
David Carlier <devnexen@gmail.com> wrote:

> test_double_dereference() uses WARN_ONCE(), which is per-call-site. Only
> the first offending event in the kernel is ever reported, and the tree
> still has six: ice_{rx,tx}_dim_template, two hfi1 txq events, mtu3_ep and
> edma_log_io. Whichever registers first hides the rest, and it taints the
> kernel for what is a source-level mistake.
> 
> Use pr_warn() instead, matching the "TRACE EVENT ERROR:" report that
> handle_dereference_arg() already emits for the same class of problem.
> All offenders are now listed on one boot.

NAK!

> 
> Fixes: b5cc230af5e5 ("tracing: Warn when an event dereferences a pointer in TP_printk()")

This is by no way a fix!

I want a big splat when this is triggered. It is a bug and needs to be
fixed immediately. pr_warn() does not make tests fail. I want this to fail
tests. I want this to panic when panic_on_warn is set.

> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
>  kernel/trace/trace_events.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index a8590d2394e3..53f32752edc0 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -415,8 +415,8 @@ static void test_double_dereference(const char *str, int len,
>  		ptr += 5;
>  		for (; ptr < end; ptr++) {
>  			if (ptr[0] == '-' && ptr[1] == '>') {
> -				WARN_ONCE(1, "Event %s has double dereference in TP_printk: %.*s\n",
> -					  trace_event_name(call), len, str);
> +				pr_warn("TRACE EVENT ERROR: Event %s has double dereference in TP_printk: %.*s\n",
> +					trace_event_name(call), len, str);

Now I am OK with adding a pr_warn() with the WARN_ONCE() but the
WARN_ONCE() must stay. But leave off the fixes tag.

-- Steve


>  				return;
>  			}
>  			if (!isalnum(*ptr) && *ptr != '_')


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

* [PATCH v2] tracing: Report every TP_printk double dereference
  2026-08-06 21:41 ` Steven Rostedt
@ 2026-08-06 21:52   ` David Carlier
  0 siblings, 0 replies; 3+ messages in thread
From: David Carlier @ 2026-08-06 21:52 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-trace-kernel,
	linux-kernel, David Carlier

WARN_ONCE() splats once per call site, so only the first offending event
registered is ever reported. The tree currently has six:
ice_{rx,tx}_dim_template, two hfi1 txq events, mtu3_ep and edma_log_io.
Whichever registers first hides the rest, and each has to be found again
on the next boot.

Add a pr_warn() next to the WARN_ONCE() so every offender is listed, the
same way test_event_printk() already pairs WARN_ON_ONCE() with pr_warn()
for unsafe %p* dereferences. The WARN_ONCE() stays so the condition still
fails tests and panics under panic_on_warn.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 kernel/trace/trace_events.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a8590d2394e3..ce902482ec7c 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -415,6 +415,8 @@ static void test_double_dereference(const char *str, int len,
 		ptr += 5;
 		for (; ptr < end; ptr++) {
 			if (ptr[0] == '-' && ptr[1] == '>') {
+				pr_warn("TRACE EVENT ERROR: Event %s has double dereference in TP_printk: %.*s\n",
+					trace_event_name(call), len, str);
 				WARN_ONCE(1, "Event %s has double dereference in TP_printk: %.*s\n",
 					  trace_event_name(call), len, str);
 				return;
-- 
2.55.0


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

end of thread, other threads:[~2026-08-06 21:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06  5:07 [PATCH] tracing: Report TP_printk double dereference with pr_warn() David Carlier
2026-08-06 21:41 ` Steven Rostedt
2026-08-06 21:52   ` [PATCH v2] tracing: Report every TP_printk double dereference David Carlier

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.