linux-stable/tools/lib
Andrii Nakryiko 71754ee427 libbpf: fix offsetof() and container_of() to work with CO-RE
[ Upstream commit bdeeed3498 ]

It seems like __builtin_offset() doesn't preserve CO-RE field
relocations properly. So if offsetof() macro is defined through
__builtin_offset(), CO-RE-enabled BPF code using container_of() will be
subtly and silently broken.

To avoid this problem, redefine offsetof() and container_of() in the
form that works with CO-RE relocations more reliably.

Fixes: 5fbc220862 ("tools/libpf: Add offsetof/container_of macro in bpf_helpers.h")
Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20230509065502.2306180-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:46:49 +02:00
..
api tools api fs: Cache cgroupfs mount point 2021-02-17 15:09:08 -03:00
bpf libbpf: fix offsetof() and container_of() to work with CO-RE 2023-07-23 13:46:49 +02:00
lockdep .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
perf perf tools: Fix segfault accessing sample_id xyarray 2022-04-27 14:38:50 +02:00
subcmd libsubcmd: Fix use-after-free for realloc(..., 0) 2022-02-23 12:03:12 +01:00
symbol libsymbols kallsyms: Move hex2u64 out of header 2020-05-05 16:35:32 -03:00
traceevent KVM: x86/mmu: Rename "nxe" role bit to "efer_nx" for macro shenanigans 2021-06-24 18:00:41 -04:00
argv_split.c
bitmap.c tools lib: Adopt bitmap_intersects() operation from the kernel sources 2021-06-30 15:28:00 -03:00
ctype.c
find_bit.c tools: sync lib/find_bit implementation 2021-05-06 19:24:12 -07:00
hweight.c
rbtree.c tools/: replace HTTP links with HTTPS ones 2020-08-07 11:33:21 -07:00
str_error_r.c
string.c tools lib: Adopt memchr_inv() from kernel 2020-11-27 08:34:52 -03:00
vsprintf.c
zalloc.c