lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250220182349.bc7b6f9a6917b04f9a7e109e@kernel.org>
Date: Thu, 20 Feb 2025 18:23:49 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux Trace Kernel
 <linux-trace-kernel@...r.kernel.org>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>, Mathieu
 Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH] ftrace: Have ftrace_free_filter() WARN and exit if ops
 is active

On Wed, 19 Feb 2025 13:50:40 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> From: Steven Rostedt <rostedt@...dmis.org>
> 
> The ftrace_free_filter() is used to reset the ops filters. But it must be
> done if the ops is not currently active (tracing). If it is, it will mess
> up the ftrace accounting of what functions are attached and what is not.
> 
> WARN and exit the ftrace_free_filter() if the ops is active when it is
> called.
> 
> Currently, it doesn't seem if anything does this, but it may in the
> future.
> 
> Link: https://lore.kernel.org/all/20250219095330.2e9f171c@gandalf.local.home/
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>

Looks good to me.

Reviewed-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

Thanks,

> ---
>  kernel/trace/ftrace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 189eb0a12f4b..4f6cad3b05b2 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1296,6 +1296,8 @@ static void free_ftrace_hash_rcu(struct ftrace_hash *hash)
>  void ftrace_free_filter(struct ftrace_ops *ops)
>  {
>  	ftrace_ops_init(ops);
> +	if (WARN_ON(ops->flags & FTRACE_OPS_FL_ENABLED))
> +		return;
>  	free_ftrace_hash(ops->func_hash->filter_hash);
>  	free_ftrace_hash(ops->func_hash->notrace_hash);
>  }
> -- 
> 2.47.2
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ