SEC("?tc")
__failure __msg("bpf_res_spin_unlock cannot be out of order") int res_spin_lock_ooo_unlock(struct __sk_buff *ctx)
{ if (bpf_res_spin_lock(&lock1)) return 0; if (bpf_res_spin_lock(&lock2)) {
bpf_res_spin_unlock(&lock1); return 0;
}
bpf_res_spin_unlock(&lock1);
bpf_res_spin_unlock(&lock2); return 0;
}
SEC("?tc")
__failure __msg("off 1 doesn't point to 'struct bpf_res_spin_lock' that is at 0") int res_spin_lock_bad_off(struct __sk_buff *ctx)
{ struct arr_elem *elem;
SEC("?tc")
__failure __msg("R1 doesn't have constant offset. bpf_res_spin_lock has to be at the constant offset") int res_spin_lock_var_off(struct __sk_buff *ctx)
{ struct arr_elem *elem;
u64 val = value;
elem = bpf_map_lookup_elem(&arrmap, &(int){0}); if (!elem) { // FIXME: Only inline assembly use in assert macro doesn't emit // BTF definition.
bpf_throw(0); return 0;
}
bpf_assert_range(val, 0, 40);
bpf_res_spin_lock((void *)&value + val); return 0;
}
SEC("?tc")
__failure __msg("map 'res_spin.bss' has no valid bpf_res_spin_lock") int res_spin_lock_no_lock_map(struct __sk_buff *ctx)
{
bpf_res_spin_lock((void *)&value + 1); return 0;
}
SEC("?tc")
__failure __msg("local 'kptr' has no valid bpf_res_spin_lock") int res_spin_lock_no_lock_kptr(struct __sk_buff *ctx)
{ struct { int i; } *p = bpf_obj_new(typeof(*p));
if (!p) return 0;
bpf_res_spin_lock((void *)p); return 0;
}
char _license[] SEC("license") = "GPL";
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 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.