1 // SPDX-License-Identifier: GPL-2.0
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
8 __uint(type, BPF_MAP_TYPE_ARRAY);
9 __uint(max_entries, 8);
12 } test_array SEC(".maps");
14 unsigned int triggered;
16 static __u64 test_cb(struct bpf_map *map, __u32 *key, __u64 *val, void *data)
21 SEC("fexit/bpf_testmod_return_ptr")
22 int BPF_PROG(handle_fexit_ret_subprogs, int arg, struct file *ret)
24 *(volatile long *)ret;
25 *(volatile int *)&ret->f_mode;
26 bpf_for_each_map_elem(&test_array, test_cb, NULL, 0);
31 SEC("fexit/bpf_testmod_return_ptr")
32 int BPF_PROG(handle_fexit_ret_subprogs2, int arg, struct file *ret)
34 *(volatile long *)ret;
35 *(volatile int *)&ret->f_mode;
36 bpf_for_each_map_elem(&test_array, test_cb, NULL, 0);
41 SEC("fexit/bpf_testmod_return_ptr")
42 int BPF_PROG(handle_fexit_ret_subprogs3, int arg, struct file *ret)
44 *(volatile long *)ret;
45 *(volatile int *)&ret->f_mode;
46 bpf_for_each_map_elem(&test_array, test_cb, NULL, 0);
51 char _license[] SEC("license") = "GPL";