diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2023-11-01 05:55:00 +0300 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-11-01 05:55:00 +0300 |
commit | a6bdc082ad1c91d389a6ba0c7a1945818f732114 (patch) | |
tree | fa630701d5d2a8bc1ab8c4abf759663bbb81aeeb /tools/testing/selftests/bpf/progs/exceptions_ext.c | |
parent | ffc253263a1375a65fa6c9f62a893e9767fbebfa (diff) | |
parent | 99c9991f4e5d77328187187d0c921a3b62bfa998 (diff) | |
download | linux-a6bdc082ad1c91d389a6ba0c7a1945818f732114.tar.xz |
Merge 'bpf-next 2023-10-16' into loongarch-next
LoongArch architecture changes for 6.7 (BPF CPU v4 support) depend on
the bpf changes to fix conflictions in selftests and work, so merge them
to create a base.
Diffstat (limited to 'tools/testing/selftests/bpf/progs/exceptions_ext.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/exceptions_ext.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/exceptions_ext.c b/tools/testing/selftests/bpf/progs/exceptions_ext.c new file mode 100644 index 000000000000..743c05185d9b --- /dev/null +++ b/tools/testing/selftests/bpf/progs/exceptions_ext.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <vmlinux.h> +#include <bpf/bpf_helpers.h> +#include "bpf_experimental.h" + +SEC("?fentry") +int pfentry(void *ctx) +{ + return 0; +} + +SEC("?fentry") +int throwing_fentry(void *ctx) +{ + bpf_throw(0); + return 0; +} + +__noinline int exception_cb(u64 cookie) +{ + return cookie + 64; +} + +SEC("?freplace") +int extension(struct __sk_buff *ctx) +{ + return 0; +} + +SEC("?freplace") +__exception_cb(exception_cb) +int throwing_exception_cb_extension(u64 cookie) +{ + bpf_throw(32); + return 0; +} + +SEC("?freplace") +__exception_cb(exception_cb) +int throwing_extension(struct __sk_buff *ctx) +{ + bpf_throw(64); + return 0; +} + +SEC("?fexit") +int pfexit(void *ctx) +{ + return 0; +} + +SEC("?fexit") +int throwing_fexit(void *ctx) +{ + bpf_throw(0); + return 0; +} + +SEC("?fmod_ret") +int pfmod_ret(void *ctx) +{ + return 0; +} + +SEC("?fmod_ret") +int throwing_fmod_ret(void *ctx) +{ + bpf_throw(0); + return 0; +} + +char _license[] SEC("license") = "GPL"; |