mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
libbpf: Properly ignore STT_SECTION symbols in legacy map definitions
The previous patch to ignore STT_SECTION symbols only added the ignore
condition in one of them. This fails if there's more than one map
definition in the 'maps' section, because the subsequent modulus check will
fail, resulting in error messages like:
libbpf: elf: unable to determine legacy map definition size in ./xdpdump_xdp.o
Fix this by also ignoring STT_SECTION in the first loop.
Fixes: c3e8c44a90
("libbpf: Ignore STT_SECTION symbols in 'maps' section")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210929213837.832449-1-toke@redhat.com
This commit is contained in:
parent
de21d8bf77
commit
161ecd5379
1 changed files with 2 additions and 0 deletions
|
@ -1868,6 +1868,8 @@ static int bpf_object__init_user_maps(struct bpf_object *obj, bool strict)
|
|||
continue;
|
||||
if (sym.st_shndx != obj->efile.maps_shndx)
|
||||
continue;
|
||||
if (GELF_ST_TYPE(sym.st_info) == STT_SECTION)
|
||||
continue;
|
||||
nr_maps++;
|
||||
}
|
||||
/* Assume equally sized map definitions */
|
||||
|
|
Loading…
Reference in a new issue