From: Greg KH <gregkh@linuxfoundation.org>
To: Koichiro Den <koichiro.den@canonical.com>
Cc: stable@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org,
mark.rutland@arm.com, mathieu.desnoyers@efficios.com,
zhengyejian1@huawei.com, hagarhem@amazon.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5.4] ftrace: use preempt_enable/disable notrace macros to avoid double fault
Date: Thu, 9 Jan 2025 11:04:27 +0100 [thread overview]
Message-ID: <2025010920-eclair-battery-fa8d@gregkh> (raw)
In-Reply-To: <20250108031736.3318120-1-koichiro.den@canonical.com>
On Wed, Jan 08, 2025 at 12:17:36PM +0900, Koichiro Den wrote:
> Since the backport commit eea46baf1451 ("ftrace: Fix possible
> use-after-free issue in ftrace_location()") on linux-5.4.y branch, the
> old ftrace_int3_handler()->ftrace_location() path has included
> rcu_read_lock(), which has mcount location inside and leads to potential
> double fault.
>
> Replace rcu_read_lock/unlock with preempt_enable/disable notrace macros
> so that the mcount location does not appear on the int3 handler path.
>
> This fix is specific to linux-5.4.y branch, the only branch still using
> ftrace_int3_handler with commit e60b613df8b6 ("ftrace: Fix possible
> use-after-free issue in ftrace_location()") backported. It also avoids
> the need to backport the code conversion to text_poke() on this branch.
>
> Reported-by: Koichiro Den <koichiro.den@canonical.com>
> Closes: https://lore.kernel.org/all/74gjhwxupvozwop7ndhrh7t5qeckomt7yqvkkbm5j2tlx6dkfk@rgv7sijvry2k
> Fixes: eea46baf1451 ("ftrace: Fix possible use-after-free issue in ftrace_location()") # linux-5.4.y
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
> ---
> kernel/trace/ftrace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, now queued up.
greg k-h
prev parent reply other threads:[~2025-01-09 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 3:17 [PATCH 5.4] ftrace: use preempt_enable/disable notrace macros to avoid double fault Koichiro Den
2025-01-09 10:04 ` Greg KH [this message]
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=2025010920-eclair-battery-fa8d@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=hagarhem@amazon.com \
--cc=koichiro.den@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=zhengyejian1@huawei.com \
/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