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

Tengda Wu <[email protected]> Sat, 25 Jul 2026 08:50:50 +0800
Newsgroups org.kernel.vger.linux-trace-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 2026/7/25 6:47, Steven Rostedt wrote:
> On Thu, 23 Jul 2026 13:34:04 +0000
> Tengda Wu <[email protected]> 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