From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Yonghong Song <yhs@meta.com>, Ze Gao <zegao2021@gmail.com>,
Jiri Olsa <olsajiri@gmail.com>, Song Liu <song@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Ze Gao <zegao@tencent.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: reject blacklisted symbols in kprobe_multi to avoid recursive trap
Date: Tue, 16 May 2023 14:10:28 +0900 [thread overview]
Message-ID: <20230516141028.d3a9cb541bf1b7ef0deb79c3@kernel.org> (raw)
In-Reply-To: <20230516133153.9627751457e0050159f077ab@kernel.org>
On Tue, 16 May 2023 13:31:53 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Sat, 13 May 2023 00:17:57 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > On Fri, 12 May 2023 07:29:02 -0700
> > Yonghong Song <yhs@meta.com> wrote:
> >
> > > A fprobe_blacklist might make sense indeed as fprobe and kprobe are
> > > quite different... Thanks for working on this.
> >
> > Hmm, I think I see the problem:
> >
> > fprobe_kprobe_handler() {
> > kprobe_busy_begin() {
> > preempt_disable() {
> > preempt_count_add() { <-- trace
> > fprobe_kprobe_handler() {
> > [ wash, rinse, repeat, CRASH!!! ]
> >
> > Either the kprobe_busy_begin() needs to use preempt_disable_notrace()
> > versions, or fprobe_kprobe_handle() needs a
> > ftrace_test_recursion_trylock() call.
>
> Oops, I got it. Is preempt_count_add() tracable? If so, kprobe_busy_begin()
> should be updated.
OK, preempt_count_add() is NOKPROBE_SYMBOL() so kprobe_busy_begin() should
be safe. The problem is in fprobe_kprobe_handler() then.
Thanks!
>
> Thanks,
>
> >
> > -- Steve
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2023-05-16 5:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 12:20 [PATCH] bpf: reject blacklisted symbols in kprobe_multi to avoid recursive trap Ze Gao
2023-05-10 14:13 ` Yonghong Song
2023-05-10 17:27 ` Jiri Olsa
2023-05-10 20:20 ` Yonghong Song
2023-05-10 23:54 ` Yonghong Song
2023-05-11 1:24 ` Ze Gao
2023-05-11 2:06 ` Ze Gao
2023-05-16 4:57 ` Masami Hiramatsu
2023-05-12 5:53 ` Ze Gao
2023-05-12 14:29 ` Yonghong Song
2023-05-12 22:33 ` Jiri Olsa
2023-05-13 4:17 ` Steven Rostedt
2023-05-13 9:19 ` Ze Gao
2023-05-14 17:11 ` Yonghong Song
2023-05-16 4:31 ` Masami Hiramatsu
2023-05-16 5:10 ` Masami Hiramatsu [this message]
2023-05-16 5:49 ` Masami Hiramatsu
2023-05-16 15:16 ` Yonghong Song
2023-05-11 1:06 ` Ze Gao
2023-05-15 5:59 ` Ze Gao
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=20230516141028.d3a9cb541bf1b7ef0deb79c3@kernel.org \
--to=mhiramat@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=olsajiri@gmail.com \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
--cc=yhs@meta.com \
--cc=zegao2021@gmail.com \
--cc=zegao@tencent.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