From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Menglong Dong <menglong8.dong@gmail.com>,
jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, kees@kernel.org, samitolvanen@google.com,
rppt@kernel.org, luto@kernel.org, mhiramat@kernel.org,
ast@kernel.org, andrii@kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH] x86/ibt: make is_endbr() notrace
Date: Fri, 19 Sep 2025 21:35:02 +0900 [thread overview]
Message-ID: <20250919213502.2d621c5b19e059134d0f8991@kernel.org> (raw)
In-Reply-To: <20250918165656.GA3409427@noisy.programming.kicks-ass.net>
On Thu, 18 Sep 2025 18:56:56 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, Sep 18, 2025 at 09:32:27PM +0800, Menglong Dong wrote:
> > On Thu, Sep 18, 2025 at 9:05???PM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > On Thu, Sep 18, 2025 at 08:09:39PM +0800, Menglong Dong wrote:
> > > > is_endbr() is called in __ftrace_return_to_handler -> fprobe_return ->
> > > > kprobe_multi_link_exit_handler -> is_endbr.
> > > >
> > > > It is not protected by the "bpf_prog_active", so it can't be traced by
> > > > kprobe-multi, which can cause recurring and panic the kernel. Fix it by
> > > > make it notrace.
> > >
> > > This is very much a riddle wrapped in an enigma. Notably
> > > kprobe_multi_link_exit_handler() does not call is_endbr(). Nor is that
> > > cryptic next line sufficient to explain why its a problem.
> > >
> > > I suspect the is_endbr() you did mean is the one in
> > > arch_ftrace_get_symaddr(), but who knows.
> >
> > Yeah, I mean
> > kprobe_multi_link_exit_handler -> ftrace_get_entry_ip ->
> > arch_ftrace_get_symaddr -> is_endbr
> > actually. And CONFIG_X86_KERNEL_IBT is enabled of course.
> >
> > >
> > > Also, depending on compiler insanity, it is possible the thing
> > > out-of-lines things like __is_endbr(), getting you yet another
> > > __fentry__ site.
> >
> > The panic happens when I run the bpf bench testing:
> > ./bench kretprobe-multi-all
> >
> > And skip the "is_endbr" fix this problem.
>
> But why does it panic? Supposedly you've done the analysis; but then
> forgot to write it down?
Yeah, that is an fprobe's bug. It should not panic. I sent a fix.
https://lore.kernel.org/all/175828305637.117978.4183947592750468265.stgit@devnote2/
Thank you,
>
> Why is kprobe_multi_link_exit_handler() special; doesn't the issue also
> exist with kprobe_multi_link_handler() ? If so, removing __fentry__
> isn't going to help much, you can just stick an actual kprobe in
> is_endbr(), right?
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2025-09-19 12:35 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 12:09 Menglong Dong
2025-09-18 13:05 ` Peter Zijlstra
2025-09-18 13:32 ` Menglong Dong
2025-09-18 16:02 ` Alexei Starovoitov
2025-09-18 16:59 ` Peter Zijlstra
2025-09-18 17:53 ` Alexei Starovoitov
2025-09-19 1:13 ` Menglong Dong
2025-09-22 6:52 ` Peter Zijlstra
2025-09-22 7:13 ` menglong.dong
2025-09-22 7:19 ` Peter Zijlstra
2025-09-22 7:21 ` Menglong Dong
2025-09-22 6:36 ` Peter Zijlstra
2025-09-18 16:56 ` Peter Zijlstra
2025-09-19 12:35 ` Masami Hiramatsu [this message]
2025-09-19 8:52 ` Masami Hiramatsu
2025-09-19 8:58 ` Menglong Dong
2025-09-19 12:32 ` Masami Hiramatsu
2025-09-19 11:57 ` [PATCH] tracing: fgraph: Protect return handler from recursion loop Masami Hiramatsu (Google)
2025-09-19 15:27 ` Steven Rostedt
2025-09-20 7:45 ` Jiri Olsa
2025-09-22 6:16 ` Masami Hiramatsu
2025-09-22 13:38 ` Jiri Olsa
2025-09-22 14:42 ` Steven Rostedt
2025-09-22 19:45 ` Jiri Olsa
2025-09-21 4:05 ` Masami Hiramatsu
2025-09-21 22:52 ` Steven Rostedt
2025-09-24 22:58 ` Masami Hiramatsu
2025-09-20 13:39 ` Menglong Dong
2025-09-21 4:06 ` Masami Hiramatsu
2025-09-21 23:00 ` Steven Rostedt
2025-09-24 22:59 ` Masami Hiramatsu
2025-09-22 5:19 ` Masami Hiramatsu
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=20250919213502.2d621c5b19e059134d0f8991@kernel.org \
--to=mhiramat@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=menglong8.dong@gmail.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=samitolvanen@google.com \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®