1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <vmlinux.h> |
3 | #include <bpf/bpf_helpers.h> |
4 | #include "bpf_experimental.h" |
5 | |
6 | SEC("?fentry" ) |
7 | int pfentry(void *ctx) |
8 | { |
9 | return 0; |
10 | } |
11 | |
12 | SEC("?fentry" ) |
13 | int throwing_fentry(void *ctx) |
14 | { |
15 | bpf_throw(0); |
16 | return 0; |
17 | } |
18 | |
19 | __noinline int exception_cb(u64 cookie) |
20 | { |
21 | return cookie + 64; |
22 | } |
23 | |
24 | SEC("?freplace" ) |
25 | int extension(struct __sk_buff *ctx) |
26 | { |
27 | return 0; |
28 | } |
29 | |
30 | SEC("?freplace" ) |
31 | __exception_cb(exception_cb) |
32 | int throwing_exception_cb_extension(u64 cookie) |
33 | { |
34 | bpf_throw(32); |
35 | return 0; |
36 | } |
37 | |
38 | SEC("?freplace" ) |
39 | __exception_cb(exception_cb) |
40 | int throwing_extension(struct __sk_buff *ctx) |
41 | { |
42 | bpf_throw(64); |
43 | return 0; |
44 | } |
45 | |
46 | SEC("?fexit" ) |
47 | int pfexit(void *ctx) |
48 | { |
49 | return 0; |
50 | } |
51 | |
52 | SEC("?fexit" ) |
53 | int throwing_fexit(void *ctx) |
54 | { |
55 | bpf_throw(0); |
56 | return 0; |
57 | } |
58 | |
59 | SEC("?fmod_ret" ) |
60 | int pfmod_ret(void *ctx) |
61 | { |
62 | return 0; |
63 | } |
64 | |
65 | SEC("?fmod_ret" ) |
66 | int throwing_fmod_ret(void *ctx) |
67 | { |
68 | bpf_throw(0); |
69 | return 0; |
70 | } |
71 | |
72 | char _license[] SEC("license" ) = "GPL" ; |
73 | |