All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] tracing: Remove "__attribute__()" from the type field of event format
Date: Mon, 14 Jul 2025 23:14:12 +0900	[thread overview]
Message-ID: <20250714231412.73e511c5c9524cde5d475770@kernel.org> (raw)
In-Reply-To: <20250712103732.79c7b9e1@batman.local.home>

On Sat, 12 Jul 2025 10:37:32 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Sat, 12 Jul 2025 20:45:24 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> 
> > Hmm, Ok. But when I sanitized the field->type in
> > update_event_fields(), it did not work. So something
> > we missed.
> 
> Ah, it's because we test to see if the event has enums or not before
> calling update_event_fields. We need something like this:
> 
> 
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 120531268abf..52829b950022 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -3349,6 +3349,8 @@ void trace_event_eval_update(struct trace_eval_map **map, int len)
>  				}
>  				update_event_printk(call, map[i]);
>  				update_event_fields(call, map[i]);
> +			} else if (need_sanitize_field_type(__type)) {
> +				sanitize_fields(call);
>  			}
>  		}
>  		cond_resched();
> 
> 
> And have the attribute fixed in both update_event_fields() and have
> your own sanitize_fields() that just does the attribute update.

Hmm, is this called unless loading modules? It seems that the
function is only kicked from trace_module_notify() -> trace_module_add_evals() -> trace_insert_eval_map() (but if mod has any trace_evals)

This sanitizing must be done with/without the module loading even if it
had no trace_evals. Thus I think it is hard to be done in
trace_event_eval_update().

Thank you,

> 
> -- Steve


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  parent reply	other threads:[~2025-07-14 14:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 11:54 [PATCH 0/2] tracing: Fix an event field filter issue Masami Hiramatsu (Google)
2025-07-08 11:54 ` [PATCH 1/2] tracing: Remove "__attribute__()" from the type field of event format Masami Hiramatsu (Google)
2025-07-09  1:06   ` kernel test robot
2025-07-09 16:51     ` Steven Rostedt
2025-07-10 13:47       ` Masami Hiramatsu
2025-07-09 17:11   ` Steven Rostedt
2025-07-10 13:45     ` Masami Hiramatsu
2025-07-10 13:53       ` Steven Rostedt
2025-07-11  1:44         ` Masami Hiramatsu
2025-07-11  5:37     ` Masami Hiramatsu
2025-07-11 16:03       ` Steven Rostedt
2025-07-12 11:45         ` Masami Hiramatsu
2025-07-12 14:37           ` Steven Rostedt
2025-07-12 15:13             ` Steven Rostedt
2025-07-14 14:14             ` Masami Hiramatsu [this message]
2025-07-14 14:32               ` Steven Rostedt
2025-07-08 11:54 ` [PATCH 2/2] tracing: Allocate field->type only if it needs to be sanitized Masami Hiramatsu (Google)

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=20250714231412.73e511c5c9524cde5d475770@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --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 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.