Andrii Nakryiko bdeeed3498 libbpf: fix offsetof() and container_of() to work with CO-RE
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: 5fbc220862fc ("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>
2023-05-12 12:05:21 -07:00
..
2023-04-26 16:07:23 -07:00
2023-02-03 13:54:22 -03:00
2023-01-21 17:52:26 +00:00
2023-04-26 16:07:23 -07:00
2023-04-25 13:00:41 -07:00
2023-04-26 09:13:44 -07:00
2023-03-10 08:18:46 -08:00
2023-02-23 10:20:49 -08:00
2023-04-18 14:22:12 -07:00