From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: kafai@fb.com, netdev@vger.kernel.org, eric@regit.org,
Daniel Borkmann <borkmann@iogearbox.net>,
brouer@redhat.com
Subject: Re: [net-next PATCH V1] samples/bpf: bpf_load.c detect and abort if ELF maps section size is wrong
Date: Sat, 29 Apr 2017 09:57:08 +0200 [thread overview]
Message-ID: <20170429095708.206dc5e7@redhat.com> (raw)
In-Reply-To: <20170429033519.2iyv7zjm7z43liuw@ast-mbp>
On Fri, 28 Apr 2017 20:35:21 -0700
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> On Fri, Apr 28, 2017 at 04:25:04PM +0200, Jesper Dangaard Brouer wrote:
> > The struct bpf_map_def was extended in commit fb30d4b71214 ("bpf: Add tests
> > for map-in-map") with member unsigned int inner_map_idx. This changed the size
> > of the maps section in the generated ELF _kern.o files.
> >
> > Unfortunately the loader in bpf_load.c does not detect or handle this. Thus,
> > older _kern.o files became incompatible, and caused hard-to-debug errors
> > where the syscall validation rejected BPF_MAP_CREATE request.
> >
> > This patch only detect the situation and aborts load_bpf_file(). It also
> > add code comments warning people that read this loader for inspiration
> > for these pitfalls.
> >
> > Fixes: fb30d4b71214 ("bpf: Add tests for map-in-map")
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
>
> Thanks!
> Acked-by: Alexei Starovoitov <ast@kernel.org>
Thanks!
> > Is it worth to implement proper backward-compat loading of older ELF objects
> > with this bpf-loader?
>
> probably yes, since it looks like a bunch of code in samples/bpf/ still
> depend on it and some features are missing in tools/lib/bpf,
> so unless we actively work on improving libbpf.a
> we won't be able to get rid of this 'sample' loader for some time.
Okay, I'll work on that next week. Hoping I can make the merge window,
so we avoid having a non-backward compat bpf_load in a kernel release.
p.s. I'll be presenting about XDP in Sweden Thur+Friday next week:
https://lundlinuxcon.org/?page=current
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2017-04-29 7:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 11:15 Strange samples/bpf loading error for maps on net-next? Jesper Dangaard Brouer
2017-04-28 5:49 ` Alexei Starovoitov
2017-04-28 6:28 ` Jesper Dangaard Brouer
2017-04-28 14:25 ` [net-next PATCH V1] samples/bpf: bpf_load.c detect and abort if ELF maps section size is wrong Jesper Dangaard Brouer
2017-04-29 3:35 ` Alexei Starovoitov
2017-04-29 7:57 ` Jesper Dangaard Brouer [this message]
2017-05-01 2:43 ` David Miller
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=20170429095708.206dc5e7@redhat.com \
--to=brouer@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=eric@regit.org \
--cc=kafai@fb.com \
--cc=netdev@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.