From: Krister Johansen <kjlx@templeofstupid.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Krister Johansen <kjlx@templeofstupid.com>,
bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
Network Development <netdev@vger.kernel.org>,
clang-built-linux <llvm@lists.linux.dev>,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH bpf] bpf: search_bpf_extables should search subprogram extables
Date: Mon, 5 Jun 2023 17:41:39 -0700 [thread overview]
Message-ID: <20230606004139.GE1977@templeofstupid.com> (raw)
In-Reply-To: <CAADnVQK7PQxj5jjfUu9sO524yLMPqE6vmzcipno1WYoeu0q-Gw@mail.gmail.com>
On Mon, Jun 05, 2023 at 04:30:29PM -0700, Alexei Starovoitov wrote:
> On Mon, Jun 5, 2023 at 9:50 AM Krister Johansen <kjlx@templeofstupid.com> wrote:
> > + if (!aux->func[i]->aux->num_exentries ||
> > + aux->func[i]->aux->extable == NULL)
> > + continue;
> > + e = search_extable(aux->func[i]->aux->extable,
> > + aux->func[i]->aux->num_exentries, addr);
> > + }
> > + }
>
> something odd here.
> We do bpf_prog_kallsyms_add(func[i]); for each subprog.
> So bpf_prog_ksym_find() in search_bpf_extables()
> should be finding ksym and extable of the subprog
> and not the main prog.
> The bug is probably elsewhere.
I have a kdump (or more) of this bug so if there's additional state
you'd like me to share, let me know. With your comments in mind, I took
another look at the ksym fields in the aux structs. I have this in the
main program:
ksym = {
start = 18446744072638420852,
end = 18446744072638423040,
name = <...>
lnode = {
next = 0xffff88d9c1065168,
prev = 0xffff88da91609168
},
tnode = {
node = {{
__rb_parent_color = 18446613068361611640,
rb_right = 0xffff88da91609178,
rb_left = 0xffff88d9f0c5a578
}, {
__rb_parent_color = 18446613068361611664,
rb_right = 0xffff88da91609190,
rb_left = 0xffff88d9f0c5a590
}}
},
prog = true
},
and this in the func[0] subprogram:
ksym = {
start = 18446744072638420852,
end = 18446744072638423040,
name = <...>
lnode = {
next = 0xffff88da91609168,
prev = 0xffffffff981f8990 <bpf_kallsyms>
},
tnode = {
node = {{
__rb_parent_color = 18446613068361606520,
rb_right = 0x0,
rb_left = 0x0
}, {
__rb_parent_color = 18446613068361606544,
rb_right = 0x0,
rb_left = 0x0
}}
},
prog = true
},
That sure looks like func[0] is a leaf in the rbtree and the main
program is an intermediate node with leaves. If that's the case, then
bpf_prog_ksym_find may have found the main program instead of the
subprogram. In that case, do you think it's better to skip the main
program's call to bpf_prog_ksym_set_addr() if it has subprograms instead
of searching for subprograms if the main program is found?
-K
next prev parent reply other threads:[~2023-06-06 1:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 16:49 [PATCH bpf] bpf: search_bpf_extables should search subprogram extables Krister Johansen
2023-06-05 23:30 ` Alexei Starovoitov
2023-06-06 0:41 ` Krister Johansen [this message]
2023-06-06 1:31 ` Alexei Starovoitov
2023-06-07 21:04 ` Krister Johansen
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=20230606004139.GE1977@templeofstupid.com \
--to=kjlx@templeofstupid.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--cc=trix@redhat.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).