Message ID | 20210929213837.832449-1-toke@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 161ecd537948a7003129889b04a3a0858687bc70 |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] libbpf: properly ignore STT_SECTION symbols in legacy map definitions | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 4 maintainers not CCed: hawk@kernel.org kuba@kernel.org netdev@vger.kernel.org davem@davemloft.net |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
bpf/vmtest-bpf-next | success | VM_Test |
bpf/vmtest-bpf-next-PR | success | PR summary |
Hello: This patch was applied to bpf/bpf-next.git (refs/heads/master): On Wed, 29 Sep 2021 23:38:37 +0200 you wrote: > 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 > > [...] Here is the summary with links: - [bpf-next] libbpf: properly ignore STT_SECTION symbols in legacy map definitions https://git.kernel.org/bpf/bpf-next/c/161ecd537948 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 453148fe8b4b..c20b2167e354 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1845,6 +1845,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 */
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: c3e8c44a9063 ("libbpf: Ignore STT_SECTION symbols in 'maps' section") Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> --- Terribly sorry for not catching this in the previous patch. I was testing with an object file with only one map definition, which worked fine :( tools/lib/bpf/libbpf.c | 2 ++ 1 file changed, 2 insertions(+)