Re: [PATCH v3] ftrace: Add global mutex to serialize trace_parser access

From: Steven Rostedt

Date: Fri Jul 24 2026 - 18:51:42 EST


On Thu, 23 Jul 2026 13:34:04 +0000
Tengda Wu <wutengda@xxxxxxxxxxxxxxx> wrote:

> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1097,6 +1097,12 @@ struct ftrace_ops global_ops = {
> FTRACE_OPS_FL_PID,
> };
>
> +/*
> + * parser_lock - Protects trace_parser state against concurrent operations.
> + * Held across trace_get_user() and subsequent buffer parsing to prevent races.
> + */
> +DEFINE_MUTEX(parser_lock);
> +

Sashiko pointed out[1] that this should be static. And it should. Could you
send a v4?

static DEFINE_MUTEX(parser_lock);

Note, you can ignore the other Sashiko comments.

-- Steve

[1] https://sashiko.dev/#/patchset/20260723133404.1926732-1-wutengda%40huaweicloud.com