]> www.infradead.org Git - users/willy/linux.git/commit
libbpf: Don't assume SHT_GNU_verdef presence for SHT_GNU_versym section
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 16 Oct 2023 18:28:40 +0000 (11:28 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 17 Oct 2023 09:43:20 +0000 (11:43 +0200)
commit137df1189d128a6b5dee2f653e054b40ef36b94c
tree63414cb538d83336a18287774f062f2f0df1eb2e
parenta3c2dd96487f1dd734c9443a3472c8dafa689813
libbpf: Don't assume SHT_GNU_verdef presence for SHT_GNU_versym section

Fix too eager assumption that SHT_GNU_verdef ELF section is going to be
present whenever binary has SHT_GNU_versym section. It seems like either
SHT_GNU_verdef or SHT_GNU_verneed can be used, so failing on missing
SHT_GNU_verdef actually breaks use cases in production.

One specific reported issue, which was used to manually test this fix,
was trying to attach to `readline` function in BASH binary.

Fixes: bb7fa09399b9 ("libbpf: Support symbol versioning for uprobe")
Reported-by: Liam Wisehart <liamwisehart@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Manu Bretelle <chantr4@gmail.com>
Reviewed-by: Fangrui Song <maskray@google.com>
Acked-by: Hengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20231016182840.4033346-1-andrii@kernel.org
tools/lib/bpf/elf.c