BPF List
 help / color / mirror / Atom feed
From: Emil Tsalapatis <etsal@meta.com>
To: <bpf@vger.kernel.org>
Cc: <ast@kernel.org>, <andrii@kernel.org>, <eddyz87@gmail.com>,
	<memxor@gmail.com>, Emil Tsalapatis <etsal@meta.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>
Subject: [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods
Date: Tue, 28 Apr 2026 06:42:52 -0700	[thread overview]
Message-ID: <20260428134252.2783519-1-etsal@meta.com> (raw)

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


             reply	other threads:[~2026-04-28 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 13:42 Emil Tsalapatis [this message]
2026-04-28 13:44 ` [PATCH bpf-next] selftests/bpf: Rename libarena malloc/free methods Ihor Solodrai
2026-04-28 14:24 ` bot+bpf-ci
2026-04-28 14:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260428134252.2783519-1-etsal@meta.com \
    --to=etsal@meta.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=memxor@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox