]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
libbpf: parse maps sections of varying size
authorCraig Gallek <kraig@google.com>
Thu, 5 Oct 2017 14:41:57 +0000 (10:41 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Oct 2017 04:42:28 +0000 (21:42 -0700)
commitb13c5c14dbfd5923d773de9661404ed9600c53ef
treecfb266d6bb37d00da439d028930d34691ae8e1c0
parentd009313c99ba575b65a944fe2c683c6346ea1721
libbpf: parse maps sections of varying size

This library previously assumed a fixed-size map options structure.
Any new options were ignored.  In order to allow the options structure
to grow and to support parsing older programs, this patch updates
the maps section parsing to handle varying sizes.

Object files with maps sections smaller than expected will have the new
fields initialized to zero.  Object files which have larger than expected
maps sections will be rejected unless all of the unrecognized data is zero.

This change still assumes that each map definition in the maps section
is the same size.

Signed-off-by: Craig Gallek <kraig@google.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/lib/bpf/libbpf.c