linux/tools/lib/bpf
Yonghong Song 69a055d546 libbpf: Fix a couple of missed btf_type_tag handling in btf.c
Commit 2dc1e488e5 ("libbpf: Support BTF_KIND_TYPE_TAG") added the
BTF_KIND_TYPE_TAG support. But to test vmlinux build with ...

  #define __user __attribute__((btf_type_tag("user")))

... I needed to sync libbpf repo and manually copy libbpf sources to
pahole. To simplify process, I used BTF_KIND_RESTRICT to simulate the
BTF_KIND_TYPE_TAG with vmlinux build as "restrict" modifier is barely
used in kernel.

But this approach missed one case in dedup with structures where
BTF_KIND_RESTRICT is handled and BTF_KIND_TYPE_TAG is not handled in
btf_dedup_is_equiv(), and this will result in a pahole dedup failure.
This patch fixed this issue and a selftest is added in the subsequent
patch to test this scenario.

The other missed handling is in btf__resolve_size(). Currently the compiler
always emit like PTR->TYPE_TAG->... so in practice we don't hit the missing
BTF_KIND_TYPE_TAG handling issue with compiler generated code. But lets
add case BTF_KIND_TYPE_TAG in the switch statement to be future proof.

Fixes: 2dc1e488e5 ("libbpf: Support BTF_KIND_TYPE_TAG")
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211115163937.3922235-1-yhs@fb.com
2021-11-16 13:10:52 +01:00
..
.gitignore libbpf: Make libbpf_version.h non-auto-generated 2021-09-13 15:36:47 -07:00
bpf_core_read.h libbpf: Fix endianness detection in BPF_CORE_READ_BITFIELD_PROBED() 2021-10-25 20:39:41 -07:00
bpf_endian.h libbpf: Make bpf_endian co-exist with vmlinux.h 2020-07-01 09:06:12 +02:00
bpf_gen_internal.h libbpf: Unify low-level BPF_PROG_LOAD APIs into bpf_prog_load() 2021-11-07 08:34:23 -08:00
bpf_helpers.h libbpf: Use static const fmt string in __bpf_printk 2021-09-17 14:02:05 -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 riscv, libbpf: Add RISC-V (RV64) support to bpf_tracing.h 2021-11-01 17:08:21 +01:00
bpf.c Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-11-15 08:49:23 -08:00
bpf.h libbpf: Unify low-level BPF_PROG_LOAD APIs into bpf_prog_load() 2021-11-07 08:34:23 -08:00
btf_dump.c libbpf: Support BTF_KIND_TYPE_TAG 2021-11-11 17:41:11 -08:00
btf.c libbpf: Fix a couple of missed btf_type_tag handling in btf.c 2021-11-16 13:10:52 +01:00
btf.h libbpf: Support BTF_KIND_TYPE_TAG 2021-11-11 17:41:11 -08:00
Build libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
gen_loader.c libbpf: Unify low-level BPF_PROG_LOAD APIs into bpf_prog_load() 2021-11-07 08:34:23 -08:00
hashmap.c libbpf: Centralize poisoning and poison reallocarray() 2020-08-18 18:38:25 -07:00
hashmap.h libbpf, hashmap: Fix undefined behavior in hash_bits 2020-11-02 23:33:51 +01:00
libbpf_common.h libbpf: Unify low-level BPF_PROG_LOAD APIs into bpf_prog_load() 2021-11-07 08:34:23 -08:00
libbpf_errno.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
libbpf_internal.h libbpf: Support BTF_KIND_TYPE_TAG 2021-11-11 17:41:11 -08:00
libbpf_legacy.h libbpf: Rename DECLARE_LIBBPF_OPTS into LIBBPF_OPTS 2021-11-07 08:34:22 -08:00
libbpf_probes.c libbpf: Remove internal use of deprecated bpf_prog_load() variants 2021-11-07 08:34:23 -08:00
libbpf_version.h libbpf: Make libbpf_version.h non-auto-generated 2021-09-13 15:36:47 -07:00
libbpf.c libbpf: Support BTF_KIND_TYPE_TAG 2021-11-11 17:41:11 -08:00
libbpf.h libbpf: Make perf_buffer__new() use OPTS-based interface 2021-11-11 16:54:05 -08:00
libbpf.map libbpf: Support BTF_KIND_TYPE_TAG 2021-11-11 17:41:11 -08:00
libbpf.pc.template
linker.c libbpf: Turn btf_dedup_opts into OPTS-based struct 2021-11-11 16:54:05 -08:00
Makefile libbpf: Compile using -std=gnu89 2021-11-09 13:27:52 -08: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: Use __BYTE_ORDER__ 2021-10-25 20:39:41 -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 libbpf: Fix skel_internal.h to set errno on loader retval < 0 2021-09-29 20:42:32 -07: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: Remove internal use of deprecated bpf_prog_load() variants 2021-11-07 08:34:23 -08:00
xsk.h libbpf: Deprecate AF_XDP support 2021-11-01 18:12:44 -07:00