From: Steven Rostedt <rostedt@goodmis.org>
To: Li Huafei <lihuafei1@huawei.com>
Cc: <mhiramat@kernel.org>, <mark.rutland@arm.com>,
<linux-kernel@vger.kernel.org>,
<linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] ftrace: Fix use-after-free for dynamic ftrace_ops
Date: Wed, 2 Nov 2022 23:23:34 -0400 [thread overview]
Message-ID: <20221102232334.0c1ae93b@rorschach.local.home> (raw)
In-Reply-To: <20221103031010.166498-1-lihuafei1@huawei.com>
On Thu, 3 Nov 2022 11:10:10 +0800
Li Huafei <lihuafei1@huawei.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
next prev parent reply other threads:[~2022-11-03 3:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 3:10 [PATCH v2] ftrace: Fix use-after-free for dynamic ftrace_ops Li Huafei
2022-11-03 3:23 ` Steven Rostedt [this message]
2022-11-03 3:24 ` Steven Rostedt
2022-11-03 3:38 ` Li Huafei
2022-11-03 4:10 ` Steven Rostedt
2022-11-03 6:33 ` Li Huafei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221102232334.0c1ae93b@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=lihuafei1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox