1
0
Fork 0
linux/tools/testing/selftests/bpf/progs/exceptions_ext.c
Daniel Baumann 79d69e5050
Adding upstream version 6.12.33.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 12:14:28 +02:00

72 lines
940 B
C

// 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";