diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2017-05-02 14:31:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-03 15:30:24 +0200 |
commit | 156450d9d964447adfb44a231c634d2f5609d110 (patch) | |
tree | b3f44925e03340a41e4ca5dd6d454e057cd04952 /samples/bpf/libbpf.h | |
parent | samples/bpf: adjust rlimit RLIMIT_MEMLOCK for traceex2, tracex3 and tracex4 (diff) | |
download | linux-156450d9d964447adfb44a231c634d2f5609d110.tar.xz linux-156450d9d964447adfb44a231c634d2f5609d110.zip |
samples/bpf: make bpf_load.c code compatible with ELF maps section changes
This patch does proper parsing of the ELF "maps" section, in-order to
be both backwards and forwards compatible with changes to the map
definition struct bpf_map_def, which gets compiled into the ELF file.
The assumption is that new features with value zero, means that they
are not in-use. For backward compatibility where loading an ELF file
with a smaller struct bpf_map_def, only copy objects ELF size, leaving
rest of loaders struct zero. For forward compatibility where ELF file
have a larger struct bpf_map_def, only copy loaders own struct size
and verify that rest of the larger struct is zero, assuming this means
the newer feature was not activated, thus it should be safe for this
older loader to load this newer ELF file.
Fixes: fb30d4b71214 ("bpf: Add tests for map-in-map")
Fixes: 409526bea3c3 ("samples/bpf: bpf_load.c detect and abort if ELF maps section size is wrong")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/libbpf.h')
0 files changed, 0 insertions, 0 deletions