From: Puranjay Mohan <puranjay@kernel.org>
To: bpf@vger.kernel.org
Cc: Puranjay Mohan <puranjay@kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Xu Kuohai" <xukuohai@huaweicloud.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH bpf-next 3/3] selftests/bpf: Enable stack argument tests for arm64
Date: Mon, 20 Apr 2026 08:36:01 -0700 [thread overview]
Message-ID: <20260420153603.4097618-4-puranjay@kernel.org> (raw)
In-Reply-To: <20260420153603.4097618-1-puranjay@kernel.org>
Now that arm64 supports stack arguments, enable the existing stack_arg,
stack_arg_kfunc and verifier_stack_arg tests for __TARGET_ARCH_arm64.
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
---
tools/testing/selftests/bpf/progs/stack_arg.c | 3 ++-
.../testing/selftests/bpf/progs/stack_arg_kfunc.c | 3 ++-
.../selftests/bpf/progs/verifier_stack_arg.c | 15 ++++++++++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/stack_arg.c b/tools/testing/selftests/bpf/progs/stack_arg.c
index 8c198ee952ff..b1276009fd30 100644
--- a/tools/testing/selftests/bpf/progs/stack_arg.c
+++ b/tools/testing/selftests/bpf/progs/stack_arg.c
@@ -23,7 +23,8 @@ struct {
int timer_result;
-#if defined(__TARGET_ARCH_x86) && defined(__BPF_FEATURE_STACK_ARGUMENT)
+#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && \
+ defined(__BPF_FEATURE_STACK_ARGUMENT)
const volatile bool has_stack_arg = true;
diff --git a/tools/testing/selftests/bpf/progs/stack_arg_kfunc.c b/tools/testing/selftests/bpf/progs/stack_arg_kfunc.c
index 6cc404d57863..3818cd0cb67b 100644
--- a/tools/testing/selftests/bpf/progs/stack_arg_kfunc.c
+++ b/tools/testing/selftests/bpf/progs/stack_arg_kfunc.c
@@ -6,7 +6,8 @@
#include "bpf_kfuncs.h"
#include "../test_kmods/bpf_testmod_kfunc.h"
-#if defined(__TARGET_ARCH_x86) && defined(__BPF_FEATURE_STACK_ARGUMENT)
+#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && \
+ defined(__BPF_FEATURE_STACK_ARGUMENT)
const volatile bool has_stack_arg = true;
diff --git a/tools/testing/selftests/bpf/progs/verifier_stack_arg.c b/tools/testing/selftests/bpf/progs/verifier_stack_arg.c
index 66dd11840a63..8f1eef911f70 100644
--- a/tools/testing/selftests/bpf/progs/verifier_stack_arg.c
+++ b/tools/testing/selftests/bpf/progs/verifier_stack_arg.c
@@ -12,7 +12,8 @@ struct {
__type(value, long long);
} map_hash_8b SEC(".maps");
-#if defined(__TARGET_ARCH_x86) && defined(__BPF_FEATURE_STACK_ARGUMENT)
+#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && \
+ defined(__BPF_FEATURE_STACK_ARGUMENT)
__noinline __used
static int subprog_6args(int a, int b, int c, int d, int e, int f)
@@ -36,6 +37,7 @@ SEC("tc")
__description("stack_arg: subprog with 6 args")
__success
__arch_x86_64
+__arch_arm64
__naked void stack_arg_6args(void)
{
asm volatile (
@@ -55,6 +57,7 @@ SEC("tc")
__description("stack_arg: two subprogs with >5 args")
__success
__arch_x86_64
+__arch_arm64
__naked void stack_arg_two_subprogs(void)
{
asm volatile (
@@ -84,6 +87,7 @@ SEC("tc")
__description("stack_arg: read from uninitialized stack arg slot")
__failure
__arch_x86_64
+__arch_arm64
__msg("invalid read from stack arg off 8 depth 0")
__naked void stack_arg_read_uninitialized(void)
{
@@ -99,6 +103,7 @@ SEC("tc")
__description("stack_arg: gap at offset -8, only wrote -16")
__failure
__arch_x86_64
+__arch_arm64
__msg("stack arg#6 not properly initialized")
__naked void stack_arg_gap_at_minus8(void)
{
@@ -120,6 +125,7 @@ __description("stack_arg: pruning with different stack arg types")
__failure
__flag(BPF_F_TEST_STATE_FREQ)
__arch_x86_64
+__arch_arm64
__msg("R1 invalid mem access 'scalar'")
__naked void stack_arg_pruning_type_mismatch(void)
{
@@ -157,6 +163,7 @@ SEC("tc")
__description("stack_arg: release_reference invalidates stack arg slot")
__failure
__arch_x86_64
+__arch_arm64
__msg("R1 invalid mem access 'scalar'")
__naked void stack_arg_release_ref(void)
{
@@ -207,6 +214,7 @@ SEC("tc")
__description("stack_arg: pkt pointer in stack arg slot invalidated after pull_data")
__failure
__arch_x86_64
+__arch_arm64
__msg("R1 invalid mem access 'scalar'")
__naked void stack_arg_stale_pkt_ptr(void)
{
@@ -246,6 +254,7 @@ SEC("tc")
__description("stack_arg: null propagation rejects deref on null branch")
__failure
__arch_x86_64
+__arch_arm64
__msg("R1 invalid mem access 'scalar'")
__naked void stack_arg_null_propagation_fail(void)
{
@@ -285,6 +294,7 @@ SEC("tc")
__description("stack_arg: missing store on one branch")
__failure
__arch_x86_64
+__arch_arm64
__msg("stack arg#6 not properly initialized")
__naked void stack_arg_missing_store_one_branch(void)
{
@@ -327,6 +337,7 @@ SEC("tc")
__description("stack_arg: share a store for both branches")
__success __retval(0)
__arch_x86_64
+__arch_arm64
__naked void stack_arg_shared_store(void)
{
asm volatile (
@@ -369,6 +380,7 @@ SEC("tc")
__description("stack_arg: write beyond max outgoing depth")
__failure
__arch_x86_64
+__arch_arm64
__msg("stack arg write offset -80 exceeds max 7 stack args")
__naked void stack_arg_write_beyond_max(void)
{
@@ -393,6 +405,7 @@ SEC("tc")
__description("stack_arg: sequential calls reuse slots")
__failure
__arch_x86_64
+__arch_arm64
__msg("stack arg#6 not properly initialized")
__naked void stack_arg_sequential_calls(void)
{
--
2.52.0
prev parent reply other threads:[~2026-04-20 15:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 15:35 [PATCH bpf-next 0/3] bpf, arm64: Support stack arguments Puranjay Mohan
2026-04-20 15:35 ` [PATCH bpf-next 1/3] bpf, arm64: Map BPF_REG_0 to x8 instead of x7 Puranjay Mohan
2026-04-20 15:36 ` [PATCH bpf-next 2/3] bpf, arm64: Add JIT support for stack arguments Puranjay Mohan
2026-04-21 2:58 ` Alexei Starovoitov
2026-04-21 11:53 ` Puranjay Mohan
2026-04-21 13:53 ` Alexei Starovoitov
2026-04-20 15:36 ` Puranjay Mohan [this message]
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=20260420153603.4097618-4-puranjay@kernel.org \
--to=puranjay@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=will@kernel.org \
--cc=xukuohai@huaweicloud.com \
--cc=yonghong.song@linux.dev \
/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