linux-kernelorg-stable/tools/lib/bpf
Andrii Nakryiko 02670deede libbpf: Handle unsupported mmap-based /sys/kernel/btf/vmlinux correctly
libbpf_err_ptr() helpers are meant to return NULL and set errno, if
there is an error. But btf_parse_raw_mmap() is meant to be used
internally and is expected to return ERR_PTR() values. Because of this
mismatch, when libbpf tries to mmap /sys/kernel/btf/vmlinux, we don't
detect the error correctly with IS_ERR() check, and never fallback to
old non-mmap-based way of loading vmlinux BTF.

Fix this by using proper ERR_PTR() returns internally.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Fixes: 3c0421c93c ("libbpf: Use mmap to parse vmlinux BTF from sysfs")
Cc: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20250606202134.2738910-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2025-06-06 14:07:07 -07:00
..
.gitignore tools build: Correct bpf fixdep dependencies 2024-08-05 12:19:48 -03:00
Build libbpf: Split field iter code into its own file kernel 2024-06-21 14:45:07 -07:00
Makefile tools: Remove redundant quiet setup 2025-02-18 16:27:43 -03:00
bpf.c libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID 2025-03-17 13:45:12 -07:00
bpf.h libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID 2025-03-17 13:45:12 -07:00
bpf_core_read.h bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ 2025-05-05 14:20:28 -07:00
bpf_endian.h
bpf_gen_internal.h libbpf: Support creating light skeleton of either endianness 2024-10-03 17:47:36 -07:00
bpf_helpers.h libbpf: Add likely/unlikely macros and use them in selftests 2025-04-04 08:53:24 -07:00
bpf_prog_linfo.c
bpf_tracing.h libbpf: Fix some typos in comments 2024-09-09 16:05:40 -07:00
btf.c libbpf: Handle unsupported mmap-based /sys/kernel/btf/vmlinux correctly 2025-06-06 14:07:07 -07:00
btf.h libbpf: Introduce kflag for type_tags and decl_tags in BTF 2025-02-05 16:17:59 -08:00
btf_dump.c libbpf: Check the kflag of type tags in btf_dump 2025-02-05 16:17:59 -08:00
btf_iter.c libbpf,bpf: Share BTF relocate-related code with kernel 2024-06-21 14:45:07 -07:00
btf_relocate.c libbpf: Fix incorrect traversal end type ID when marking BTF_IS_EMBEDDED 2025-01-16 15:34:18 -08:00
elf.c libbpf: Stringify errno in log messages in the remaining code 2024-11-11 20:29:45 -08:00
features.c libbpf: Stringify errno in log messages in the remaining code 2024-11-11 20:29:45 -08:00
gen_loader.c libbpf: Stringify errno in log messages in the remaining code 2024-11-11 20:29:45 -08:00
hashmap.c libbpf: Hashmap interface update to allow both long and void* keys/values 2022-11-09 20:45:14 -08:00
hashmap.h libbpf: Fix possible compiler warnings in hashmap 2024-10-11 12:36:59 -07:00
libbpf.c libbpf: Check bpf_map_skeleton link for NULL 2025-05-14 09:30:06 -07:00
libbpf.h bpf-next-6.16 2025-05-28 15:52:42 -07:00
libbpf.map libbpf: Add getters for BTF.ext func and line info 2025-04-09 16:16:56 -07:00
libbpf.pc.template
libbpf_common.h libbpf: Fix potential uninitialized tail padding with LIBBPF_OPTS_RESET 2023-11-09 19:07:51 -08:00
libbpf_errno.c libbpf: Optimized return value in libbpf_strerror when errno is libbpf errno 2022-12-14 18:39:33 +01:00
libbpf_internal.h libbpf: Fix implicit memfd_create() for bionic 2025-04-04 08:52:37 -07:00
libbpf_legacy.h libbpf: Fix some typos in comments 2024-09-09 16:05:40 -07:00
libbpf_probes.c bpf: improve error message for unsupported helper 2024-03-28 18:30:53 -07:00
libbpf_version.h libbpf: start v1.6 development cycle 2024-10-29 13:42:52 -07:00
linker.c libbpf: Use proper errno value in linker 2025-04-30 09:04:20 -07:00
netlink.c libbpf: Support creating and destroying qdisc 2025-04-17 10:54:41 -07:00
nlattr.c libbpf: Use proper errno value in nlattr 2025-05-12 15:22:54 -07:00
nlattr.h libbpf: add API to get XDP/XSK supported features 2023-02-02 20:48:24 -08:00
relo_core.c libbpf: fix LDX/STX/ST CO-RE relocation size adjustment logic 2025-02-14 19:58:05 -08:00
relo_core.h
ringbuf.c libbpf: Stringify errno in log messages in the remaining code 2024-11-11 20:29:45 -08:00
skel_internal.h libbpf: Support creating light skeleton of either endianness 2024-10-03 17:47:36 -07:00
str_error.c libbpf: Add namespace for errstr making it libbpf_errstr 2025-03-21 13:44:54 -07:00
str_error.h libbpf: Add namespace for errstr making it libbpf_errstr 2025-03-21 13:44:54 -07:00
strset.c libbpf: Hashmap interface update to allow both long and void* keys/values 2022-11-09 20:45:14 -08:00
strset.h
usdt.bpf.h libbpf: Implement bpf_usdt_arg_size BPF function 2025-02-26 08:59:44 -08:00
usdt.c libbpf: don't adjust USDT semaphore address if .stapsdt.base addr is missing 2024-12-02 08:41:17 -08:00
zip.c libbpf: Remove unneeded semicolon 2024-10-03 17:47:35 -07:00
zip.h libbpf: Implement basic zip archive parsing support 2023-03-01 16:05:34 -08:00