* [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods
@ 2026-04-28 13:42 Emil Tsalapatis
2026-04-28 13:44 ` Ihor Solodrai
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Emil Tsalapatis @ 2026-04-28 13:42 UTC (permalink / raw)
To: bpf; +Cc: ast, andrii, eddyz87, memxor, Emil Tsalapatis, Ihor Solodrai
From: Emil Tsalapatis <emil@etsalapatis.com>
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: 7c8d208d816d0504aa916138ae097d9cb4ed4e56 ("Introduce arena library and runtime)
---
tools/testing/selftests/bpf/libarena/Makefile | 2 --
.../selftests/bpf/libarena/include/libarena/common.h | 6 +++---
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);
}
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods
2026-04-28 13:42 [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods Emil Tsalapatis
@ 2026-04-28 13:44 ` Ihor Solodrai
2026-04-28 14:24 ` bot+bpf-ci
2026-04-28 14:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ihor Solodrai @ 2026-04-28 13:44 UTC (permalink / raw)
To: Emil Tsalapatis, bpf; +Cc: ast, andrii, eddyz87, memxor
On 4/28/26 2:42 PM, Emil Tsalapatis wrote:
> From: Emil Tsalapatis <emil@etsalapatis.com>
>
> 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: 7c8d208d816d0504aa916138ae097d9cb4ed4e56 ("Introduce arena library and runtime)
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> ---
> tools/testing/selftests/bpf/libarena/Makefile | 2 --
> .../selftests/bpf/libarena/include/libarena/common.h | 6 +++---
> 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);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods
2026-04-28 13:42 [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods Emil Tsalapatis
2026-04-28 13:44 ` Ihor Solodrai
@ 2026-04-28 14:24 ` bot+bpf-ci
2026-04-28 14:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: bot+bpf-ci @ 2026-04-28 14:24 UTC (permalink / raw)
To: etsal, bpf
Cc: ast, andrii, eddyz87, memxor, etsal, ihor.solodrai, ast, andrii,
daniel, martin.lau, eddyz87, yonghong.song, clm, ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
> Fixes: 7c8d208d816d0504aa916138ae097d9cb4ed4e56 ("Introduce arena library and runtime)
The Fixes: tag points to a merge commit, but kernel convention prefers
pointing to the specific commit that introduced the problematic code.
The malloc/free function definitions that conflict with s390 architecture
were directly introduced by commit 86426a28c52d ("selftests/bpf: Add buddy
allocator for libarena").
Should the Fixes: tag point to commit 86426a28c52d instead?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/25057261385
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods
2026-04-28 13:42 [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods Emil Tsalapatis
2026-04-28 13:44 ` Ihor Solodrai
2026-04-28 14:24 ` bot+bpf-ci
@ 2026-04-28 14:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-04-28 14:50 UTC (permalink / raw)
To: Emil Tsalapatis; +Cc: bpf, ast, andrii, eddyz87, memxor, ihor.solodrai
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Tue, 28 Apr 2026 06:42:52 -0700 you wrote:
> From: Emil Tsalapatis <emil@etsalapatis.com>
>
> 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: 7c8d208d816d0504aa916138ae097d9cb4ed4e56 ("Introduce arena library and runtime)
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Rename libarena malloc/free methods
https://git.kernel.org/bpf/bpf-next/c/9f5b3ffc3f1d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-28 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 13:42 [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods Emil Tsalapatis
2026-04-28 13:44 ` Ihor Solodrai
2026-04-28 14:24 ` bot+bpf-ci
2026-04-28 14:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox