FILE
struct_ops_private_stack_recur.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/bpf/progs/struct_ops_private_stack_recur.c
1// SPDX-License-Identifier: GPL-2.0 2 3#include <vmlinux.h> 4#include <bpf/bpf_helpers.h> 5#include <bpf/bpf_tracing.h> 6#include "../test_kmods/bpf_testmod.h" 7 8char _license[] SEC("license") = "GPL"; 9 10#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64) 11bool skip __attribute((__section__(".data"))) = false; 12#else 13bool skip = true; 14#endif 15 16void bpf_testmod_ops3_call_test_1(void) __ksym; 17 18int val_i, val_j; 19 20__noinline static int subprog2(int *a, int *b) 21{ 22 return val_i + a[1] + b[20]; 23} 24 25__noinline static int subprog1(int *a) 26{ 27 /* stack size 400 bytes */ 28 int b[100] = {}; 29 30 b[20] = 2; 31 return subprog2(a, b); 32} 33 34 35SEC("struct_ops") 36int BPF_PROG(test_1) 37{ 38 /* stack size 20 bytes */ 39 int a[5] = {}; 40 41 a[1] = 1; 42 val_j += subprog1(a); 43 bpf_testmod_ops3_call_test_1(); 44 return 0; 45} 46 47SEC(".struct_ops") 48struct bpf_testmod_ops3 testmod_1 = { 49 .test_1 = (void *)test_1, 50};
~/
Read-only file preview.