[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170429033519.2iyv7zjm7z43liuw@ast-mbp>
Date: Fri, 28 Apr 2017 20:35:21 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: kafai@...com, netdev@...r.kernel.org, eric@...it.org,
Daniel Borkmann <borkmann@...earbox.net>
Subject: Re: [net-next PATCH V1] samples/bpf: bpf_load.c detect and abort if
ELF maps section size is wrong
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@...hat.com>
Thanks!
Acked-by: Alexei Starovoitov <ast@...nel.org>
> 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.
Powered by blists - more mailing lists