Re: [PATCH bpf v2] bpftool: Don't crash on missing jited insns or ksyms

From: Jakub Kicinski
Date: Tue Dec 10 2019 - 16:24:37 EST


On Tue, 10 Dec 2019 22:09:55 +0100, Toke HÃiland-JÃrgensen wrote:
> Jakub Kicinski <jakub.kicinski@xxxxxxxxxxxxx> writes:
> > On Tue, 10 Dec 2019 19:14:12 +0100, Toke HÃiland-JÃrgensen wrote:
> >> When the kptr_restrict sysctl is set, the kernel can fail to return
> >> jited_ksyms or jited_prog_insns, but still have positive values in
> >> nr_jited_ksyms and jited_prog_len. This causes bpftool to crash when trying
> >> to dump the program because it only checks the len fields not the actual
> >> pointers to the instructions and ksyms.
> >>
> >> Fix this by adding the missing checks.
> >>
> >> Signed-off-by: Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx>
> >
> > Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
> >
> > and
> >
> > Fixes: f84192ee00b7 ("tools: bpftool: resolve calls without using imm field")
> >
> > ?
>
> Yeah, guess so? Although I must admit it's not quite clear to me whether
> bpftool gets stable backports, or if it follows the "only moving
> forward" credo of libbpf?

bpftool does not have a GH repo, and seeing strength of Alexei's
arguments in the recent discussion - I don't think it will. So no
reason for bpftool to be "special" âï.

Then again seeing Andrii's zeal for pushing the codegen stuff into
bpftool, maybe Facebook's intention is to make it so.

Hard to tell what to do when standard practices don't apply, sigh.

> Anyhow, I don't suppose it'll hurt to have the Fixes: tag(s) in there;
> does Patchwork pick these up (or can you guys do that when you apply
> this?), or should I resend?

I don't think it does, but perhaps Daniel's scripts do.

Either way I don't think it's worth a resend.