diff options
| author | Emil Tsalapatis <emil@etsalapatis.com> | 2026-04-28 16:42:52 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-04-28 17:40:21 +0300 |
| commit | 9f5b3ffc3f1dac7204e32eeeff84bc5cc55c393e (patch) | |
| tree | fa7dc170163aeed7d9db8cfaec1386ad5352025d | |
| parent | cfeddb4244268c246d67cbe50269a9475cb112fc (diff) | |
| download | linux-9f5b3ffc3f1dac7204e32eeeff84bc5cc55c393e.tar.xz | |
selftests/bpf: Rename libarena malloc/free methods
The s390 architecture uses the token "free" for an enum, conflicting
with the malloc/free definitions. Rename the calls to arena_malloc and
arena_free instead to prevent collisions.
Reported-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Emil Tsalapatis <etsal@meta.com>
Fixes: 86426a28c52d ("selftests/bpf: Add buddy allocator for libarena")
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260428134252.2783519-1-etsal@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| -rw-r--r-- | tools/testing/selftests/bpf/libarena/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/libarena/include/libarena/common.h | 6 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/libarena/src/common.bpf.c | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/libarena/Makefile b/tools/testing/selftests/bpf/libarena/Makefile index 3c695f9c0054..5e2ab514805e 100644 --- a/tools/testing/selftests/bpf/libarena/Makefile +++ b/tools/testing/selftests/bpf/libarena/Makefile @@ -51,8 +51,6 @@ ASAN_FLAGS += -mllvm -asan-destructor-kind=none override BPF_CFLAGS += -DENABLE_ATOMICS_TESTS override BPF_CFLAGS += -O2 -g override BPF_CFLAGS += -Wno-incompatible-pointer-types-discards-qualifiers -# Required to define our own arena-based free() -override BPF_CFLAGS += -Wno-incompatible-library-redeclaration # Required for suppressing harmless vmlinux.h-related warnings. override BPF_CFLAGS += -Wno-missing-declarations override BPF_CFLAGS += $(INCLUDES) diff --git a/tools/testing/selftests/bpf/libarena/include/libarena/common.h b/tools/testing/selftests/bpf/libarena/include/libarena/common.h index e54cb7b869bd..ca1a6c1d6477 100644 --- a/tools/testing/selftests/bpf/libarena/include/libarena/common.h +++ b/tools/testing/selftests/bpf/libarena/include/libarena/common.h @@ -48,9 +48,9 @@ extern volatile u64 asan_violated; int arena_fls(__u64 word); -u64 malloc_internal(size_t size); -#define malloc(size) ((void __arena *)malloc_internal((size))) -void free(void __arena *ptr); +u64 arena_malloc_internal(size_t size); +#define arena_malloc(size) ((void __arena *)arena_malloc_internal((size))) +void arena_free(void __arena *ptr); /* * The verifier associates arenas with programs by checking LD.IMM diff --git a/tools/testing/selftests/bpf/libarena/src/common.bpf.c b/tools/testing/selftests/bpf/libarena/src/common.bpf.c index e5da1e37e83e..544bf9e1cb38 100644 --- a/tools/testing/selftests/bpf/libarena/src/common.bpf.c +++ b/tools/testing/selftests/bpf/libarena/src/common.bpf.c @@ -38,12 +38,12 @@ __weak int arena_buddy_reset(void) return buddy_init(&buddy); } -__weak u64 malloc_internal(size_t size) +__weak u64 arena_malloc_internal(size_t size) { return buddy_alloc_internal(&buddy, size); } -__weak void free(void __arg_arena __arena *ptr) +__weak void arena_free(void __arg_arena __arena *ptr) { buddy_free_internal(&buddy, (u64)ptr); } |
