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

From: Tengda Wu

Date: Fri Jul 24 2026 - 20:54:13 EST




On 2026/7/25 6:47, Steven Rostedt wrote:
> 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

Sorry, I overlooked that. Will add static and send v4 right away.

Thanks,
Tengda