Files
linux/tools/testing/selftests/bpf/progs/struct_ops_private_stack.c
Puranjay Mohan e9f545d0d3 selftests/bpf: Enable private stack tests for arm64
As arm64 JIT now supports private stack, make sure all relevant tests
run on arm64 architecture.

Relevant tests:

 #415/1   struct_ops_private_stack/private_stack:OK
 #415/2   struct_ops_private_stack/private_stack_fail:OK
 #415/3   struct_ops_private_stack/private_stack_recur:OK
 #415     struct_ops_private_stack:OK
 #549/1   verifier_private_stack/Private stack, single prog:OK
 #549/2   verifier_private_stack/Private stack, subtree > MAX_BPF_STACK:OK
 #549/3   verifier_private_stack/No private stack:OK
 #549/4   verifier_private_stack/Private stack, callback:OK
 #549/5   verifier_private_stack/Private stack, exception in mainprog:OK
 #549/6   verifier_private_stack/Private stack, exception in subprog:OK
 #549/7   verifier_private_stack/Private stack, async callback, not nested:OK
 #549/8   verifier_private_stack/Private stack, async callback, potential nesting:OK
 #549     verifier_private_stack:OK
 Summary: 2/11 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20250724120257.7299-4-puranjay@kernel.org
2025-07-26 21:27:15 +02:00

63 lines
1.0 KiB
C

// SPDX-License-Identifier: GPL-2.0
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include "../test_kmods/bpf_testmod.h"
char _license[] SEC("license") = "GPL";
#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
bool skip __attribute((__section__(".data"))) = false;
#else
bool skip = true;
#endif
void bpf_testmod_ops3_call_test_2(void) __ksym;
int val_i, val_j;
__noinline static int subprog2(int *a, int *b)
{
return val_i + a[10] + b[20];
}
__noinline static int subprog1(int *a)
{
/* stack size 200 bytes */
int b[50] = {};
b[20] = 2;
return subprog2(a, b);
}
SEC("struct_ops")
int BPF_PROG(test_1)
{
/* stack size 400 bytes */
int a[100] = {};
a[10] = 1;
val_i = subprog1(a);
bpf_testmod_ops3_call_test_2();
return 0;
}
SEC("struct_ops")
int BPF_PROG(test_2)
{
/* stack size 200 bytes */
int a[50] = {};
a[10] = 3;
val_j = subprog1(a);
return 0;
}
SEC(".struct_ops")
struct bpf_testmod_ops3 testmod_1 = {
.test_1 = (void *)test_1,
.test_2 = (void *)test_2,
};