[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221102232334.0c1ae93b@rorschach.local.home>
Date: Wed, 2 Nov 2022 23:23:34 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Li Huafei <lihuafei1@...wei.com>
Cc: <mhiramat@...nel.org>, <mark.rutland@....com>,
<linux-kernel@...r.kernel.org>,
<linux-trace-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] ftrace: Fix use-after-free for dynamic ftrace_ops
On Thu, 3 Nov 2022 11:10:10 +0800
Li Huafei <lihuafei1@...wei.com> wrote:
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3028,18 +3028,8 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command)
> command |= FTRACE_UPDATE_TRACE_FUNC;
> }
>
> - if (!command || !ftrace_enabled) {
> - /*
> - * If these are dynamic or per_cpu ops, they still
> - * need their data freed. Since, function tracing is
> - * not currently active, we can just free them
> - * without synchronizing all CPUs.
> - */
> - if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
> - goto free_ops;
> -
> - return 0;
> - }
> + if (!command || !ftrace_enabled)
> + goto out;
>
Hi Li,
I think you misunderstood me. What I was suggesting was to get rid of
the ftrace_enabled check. The DYNAMIC part is most definitely needed.
if (!command) {
if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
goto out;
return 0;
}
-- Steve
Powered by blists - more mailing lists