linux-stable/tools/lib/bpf
Toke Høiland-Jørgensen 9fc0420864 libbpf: Don't crash on object files with no symbol tables
[ Upstream commit 03e601f48b ]

If libbpf encounters an ELF file that has been stripped of its symbol
table, it will crash in bpf_object__add_programs() when trying to
dereference the obj->efile.symbols pointer.

Fix this by erroring out of bpf_object__elf_collect() if it is not able
able to find the symbol table.

v2:
  - Move check into bpf_object__elf_collect() and add nice error message

Fixes: 6245947c1b ("libbpf: Allow gaps in BPF program sections to support overriden weak functions")
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/20210901114812.204720-1-toke@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 19:16:22 +01:00
..
.gitignore libbpf: Stop using feature-detection Makefiles 2021-02-04 01:22:00 +01:00
bpf.c libbpf: Add bpf_cookie support to bpf_link_create() API 2021-08-17 00:45:08 +02:00
bpf.h libbpf: Add bpf_cookie support to bpf_link_create() API 2021-08-17 00:45:08 +02:00
bpf_core_read.h selftests/bpf: Fix BPF_CORE_READ_BITFIELD() macro 2021-04-26 18:37:13 -07:00
bpf_endian.h
bpf_gen_internal.h libbpf: Cleanup temp FDs when intermediate sys_bpf fails. 2021-05-19 00:40:44 +02:00
bpf_helpers.h libbpf: Move BPF_SEQ_PRINTF and BPF_SNPRINTF to bpf_helpers.h 2021-05-26 10:45:41 -07:00
bpf_prog_linfo.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
bpf_tracing.h libbpf: Fail compilation if target arch is missing 2021-06-16 20:15:30 -07:00
btf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-08-13 06:41:22 -07:00
btf.h libbpf: Add btf__load_vmlinux_btf/btf__load_module_btf 2021-07-30 12:21:29 -07:00
btf_dump.c libbpf: Propagate errors when retrieving enum value for typed data display 2021-07-20 13:49:25 -07:00
Build libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
gen_loader.c libbpf: Cleanup temp FDs when intermediate sys_bpf fails. 2021-05-19 00:40:44 +02:00
hashmap.c
hashmap.h libbpf, hashmap: Fix undefined behavior in hash_bits 2020-11-02 23:33:51 +01:00
libbpf.c libbpf: Don't crash on object files with no symbol tables 2021-11-18 19:16:22 +01:00
libbpf.h libbpf: Add uprobe ref counter offset support for USDT semaphores 2021-08-17 00:45:08 +02:00
libbpf.map libbpf: Add bpf_cookie to perf_event, kprobe, uprobe, and tp attach APIs 2021-08-17 00:45:08 +02:00
libbpf.pc.template
libbpf_common.h
libbpf_errno.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
libbpf_internal.h libbpf: Add bpf_cookie support to bpf_link_create() API 2021-08-17 00:45:08 +02:00
libbpf_legacy.h libbpf: Streamline error reporting for low-level APIs 2021-05-25 17:32:35 -07:00
libbpf_probes.c libbpf: Fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPT 2021-08-07 01:38:52 +02:00
linker.c libbpf: Fix segfault in static linker for objects without BTF 2021-09-28 09:29:03 +02:00
Makefile libbpf: Re-build libbpf.so when libbpf.map changes 2021-08-17 00:45:07 +02:00
netlink.c libbpf: Switch to void * casting in netlink helpers 2021-06-22 17:04:02 +02:00
nlattr.c libbpf: Switch to void * casting in netlink helpers 2021-06-22 17:04:02 +02:00
nlattr.h libbpf: Switch to void * casting in netlink helpers 2021-06-22 17:04:02 +02:00
relo_core.c libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
relo_core.h libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
ringbuf.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
skel_internal.h bpf: Add cmd alias BPF_PROG_RUN 2021-05-19 15:35:12 +02:00
str_error.c
str_error.h
strset.c libbpf: Fix memory leak in strset 2021-10-01 22:54:38 +02:00
strset.h libbpf: Extract internal set-of-strings datastructure APIs 2021-03-18 16:14:22 -07:00
xsk.c libbpf: Fixes incorrect rx_ring_setup_done 2021-06-07 17:44:03 -07:00
xsk.h libbpf: xsk: Move barriers from libbpf_util.h to xsk.h 2021-03-10 13:45:16 -08:00