__noinline staticint subprog_lock(struct __sk_buff *ctx)
{ volatileint ret = 0;
bpf_spin_lock(&lock); if (ctx->len)
bpf_throw(0); return ret;
}
SEC("?tc")
__failure __msg("function calls are not allowed while holding a lock") int reject_with_lock(void *ctx)
{
bpf_spin_lock(&lock);
bpf_throw(0); return 0;
}
SEC("?tc")
__failure __msg("function calls are not allowed while holding a lock") int reject_subprog_with_lock(void *ctx)
{ return subprog_lock(ctx);
}
SEC("?tc")
__failure __msg("BPF_EXIT instruction in main prog cannot be used inside bpf_rcu_read_lock-ed region") int reject_with_rcu_read_lock(void *ctx)
{
bpf_rcu_read_lock();
bpf_throw(0); return 0;
}
SEC("?tc")
__failure __msg("BPF_EXIT instruction in main prog cannot be used inside bpf_rcu_read_lock-ed region") int reject_subprog_with_rcu_read_lock(void *ctx)
{
bpf_rcu_read_lock(); return throwing_subprog(ctx);
}
__noinline int throwing_exception_cb(u64 c)
{
bpf_throw(0); return c;
}
__noinline int exception_cb1(u64 c)
{ return c;
}
__noinline int exception_cb2(u64 c)
{ return c;
}
static __noinline int static_func(struct __sk_buff *ctx)
{ return exception_cb1(ctx->tstamp);
}
__noinline int global_func(struct __sk_buff *ctx)
{ return exception_cb1(ctx->tstamp);
}
SEC("?tc")
__exception_cb(throwing_exception_cb)
__failure __msg("cannot be called from callback subprog") int reject_throwing_exception_cb(struct __sk_buff *ctx)
{ return 0;
}
SEC("?tc")
__exception_cb(exception_cb1)
__exception_cb(exception_cb2)
__failure __msg("multiple exception callback tags for main subprog") int reject_multiple_exception_cb(struct __sk_buff *ctx)
{
bpf_throw(0); return 16;
}
__noinline int exception_cb_bad_ret(u64 c)
{ return c;
}
SEC("?fentry/bpf_check")
__exception_cb(exception_cb_bad_ret)
__failure __msg("At program exit the register R0 has unknown scalar value should") int reject_set_exception_cb_bad_ret1(void *ctx)
{ return 0;
}
SEC("?fentry/bpf_check")
__failure __msg("At program exit the register R1 has smin=64 smax=64 should") int reject_set_exception_cb_bad_ret2(void *ctx)
{
bpf_throw(64); return 0;
}
SEC("?tc")
__failure __msg("cannot be called from callback") int reject_exception_throw_cb(struct __sk_buff *ctx)
{
bpf_loop(5, loop_cb1, NULL, 0); return 0;
}
SEC("?tc")
__failure __msg("cannot be called from callback") int reject_exception_throw_cb_diff(struct __sk_buff *ctx)
{ if (ctx->protocol)
bpf_loop(5, loop_cb1, NULL, 0); else
bpf_loop(5, loop_cb2, NULL, 0); return 0;
}
char _license[] SEC("license") = "GPL";
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.