Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/testing/selftests/bpf/progs/sockopt_qos_to_cc.c | int sockopt_qos_to_cc(struct bpf_sockopt *ctx) {
void *optval_end = ctx->optval_end;
int *optval = ctx->optval;
char buf[TCP_CA_NAME_MAX];
char cc_reno[TCP_CA_NAME_MAX] = "reno";
char cc_cubic[TCP_CA_NAME_MAX] = "cubic";
if (ctx->level != SOL_IPV6 || ctx->optname != IPV6_TCLASS)
return 1;
if (optval... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/stacktrace_map_skip.c | int oncpu(struct trace_event_raw_sched_switch *ctx) {
__u32 max_len = TEST_STACK_DEPTH * sizeof(__u64);
__u32 key = 0, val = 0;
__u64 *stack_p;
if (pid != (bpf_get_current_pid_tgid() >> 32))
return 0;
if (control)
return 0;
key = bpf_get_stackid(ctx, &stackmap, TEST_STACK_DEPTH);
if ((int)key >... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/strncmp_test.c | int strncmp_bad_not_null_term_target(void *ctx) {
cmp_ret = bpf_strncmp(str, STRNCMP_STR_SZ, no_str_target);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/strobemeta.h | static int read_var_callback(__u32 index, struct read_var_ctx *ctx) {
switch (ctx->type) {
case READ_INT_VAR:
if (index >= STROBE_MAX_INTS)
return 1;
read_int_var(ctx->cfg, index, ctx->tls_base, ctx->value, ctx->data);
break;
case READ_MAP_VAR:
if (index >= STROBE_MAX_MAPS)
return 1;
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/syscall.c | static int btf_load(void) {
struct btf_blob {
struct btf_header btf_hdr;
__u32 types[8];
__u32 str;
} raw_btf = {
.btf_hdr =
{
.magic = BTF_MAGIC,
.version = BTF_VERSION,
.hdr_len = sizeof(struct btf_header),
.type_len = sizeof(__u3... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall4.c | int entry(struct __sk_buff *skb) {
bpf_tail_call(skb, &jmp_table, selector);
return 3;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall5.c | int entry(struct __sk_buff *skb) {
int idx = 0;
if (selector == 1234)
idx = 1;
else if (selector == 5678)
idx = 2;
bpf_tail_call(skb, &jmp_table, idx);
return 3;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall6.c | int classifier_0(struct __sk_buff *skb) {
count++;
if (__builtin_constant_p(which))
__bpf_unreachable();
bpf_tail_call(skb, &jmp_table, which);
return 1;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall6.c | int entry(struct __sk_buff *skb) {
if (__builtin_constant_p(which))
__bpf_unreachable();
bpf_tail_call(skb, &jmp_table, which);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf1.c | int entry(struct __sk_buff *skb) {
bpf_tail_call_static(skb, &jmp_table, 1);
return subprog_tail(skb);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c | int classifier_0(struct __sk_buff *skb) {
count++;
return subprog_tail(skb);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf3.c |
__noinline int subprog_tail2(struct __sk_buff *skb) {
volatile char arr[64] = {};
if (load_word(skb, 0) || load_half(skb, 0))
bpf_tail_call_static(skb, &jmp_table, 10);
else
bpf_tail_call_static(skb, &jmp_table, 1);
return skb->len;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf4.c |
static __always_inline int subprog_noise(void) {
__u32 key = 0;
bpf_map_lookup_elem(&nop_table, &key);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf4.c |
__noinline int subprog_tail(struct __sk_buff *skb) {
bpf_tail_call_static(skb, &jmp_table, 0);
return skb->len;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf4.c | int classifier_2(struct __sk_buff *skb) {
count++;
return subprog_tail_2(skb);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tailcall_bpf2bpf4.c | int entry(struct __sk_buff *skb) { return subprog_tail(skb); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_common.h |
static inline int tasks_kfunc_map_insert(struct task_struct *p) {
struct __tasks_kfunc_map_value local, *v;
long status;
struct task_struct *acquired, *old;
s32 pid;
status = bpf_probe_read_kernel(&pid, sizeof(pid), &p->pid);
if (status)
return status;
local.task = NULL;
status = bpf_map_update_e... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_failure.c | int BPF_PROG(task_kfunc_acquire_unreleased, struct task_struct *task,
u64 clone_flags) {
struct task_struct *acquired;
acquired = bpf_task_acquire(task);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_failure.c | int BPF_PROG(task_kfunc_xchg_unreleased, struct task_struct *task,
u64 clone_flags) {
struct task_struct *kptr;
struct __tasks_kfunc_map_value *v;
v = insert_lookup_task(task);
if (!v)
return 0;
kptr = bpf_kptr_xchg(&v->task, NULL);
if (!kptr)
return 0;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_failure.c | int BPF_PROG(task_kfunc_release_null, struct task_struct *task,
u64 clone_flags) {
struct __tasks_kfunc_map_value local, *v;
long status;
struct task_struct *acquired, *old;
s32 pid;
status = bpf_probe_read_kernel(&pid, sizeof(pid), &task->pid);
if (status)
return 0;
local.task = NULL;
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_failure.c | int BPF_PROG(task_kfunc_release_unacquired, struct task_struct *task,
u64 clone_flags) {
bpf_task_release(task);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_success.c | int BPF_PROG(test_task_acquire_release_argument, struct task_struct *task,
u64 clone_flags) {
if (!is_test_kfunc_task())
return 0;
return test_acquire_release(task);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_kfunc_success.c | int BPF_PROG(test_task_from_pid_current, struct task_struct *task,
u64 clone_flags) {
struct task_struct *current, *acquired;
if (!is_test_kfunc_task())
return 0;
lookup_compare_pid(bpf_get_current_task_btf());
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_local_storage.c | int BPF_PROG(on_enter, struct pt_regs *regs, long id) {
struct task_struct *task;
long *ptr;
task = bpf_get_current_task_btf();
if (task->pid != target_pid)
return 0;
ptr =
bpf_task_storage_get(&enter_id, task, 0, BPF_LOCAL_STORAGE_GET_F_CREATE);
if (!ptr)
return 0;
__sync_fetch_and_add(&... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/task_ls_recursion.c | int BPF_PROG(on_update) {
struct task_struct *task = bpf_get_current_task_btf();
long *ptr;
if (!test_pid || task->pid != test_pid)
return 0;
ptr = bpf_task_storage_get(&map_a, task, 0, BPF_LOCAL_STORAGE_GET_F_CREATE);
if (ptr) {
int err;
*ptr += 1;
err = bpf_task_storage_delete(&map_a, ta... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tcp_ca_incompl_cong_ops.c |
static inline struct tcp_sock *tcp_sk(const struct sock *sk) {
return (struct tcp_sock *)sk;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tcp_ca_incompl_cong_ops.c | __u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk) {
return tcp_sk(sk)->snd_ssthresh;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/tcp_ca_write_sk_pacing.c |
static inline struct tcp_sock *tcp_sk(const struct sock *sk) {
return (struct tcp_sock *)sk;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_autoattach.c | int prog1(const void *ctx) {
prog1_called = true;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_autoload.c | int prog1(const void *ctx) {
prog1_called = true;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | int handle_kretprobe(struct pt_regs *ctx) {
update(ctx, &kretprobe_res);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | int handle_uprobe(struct pt_regs *ctx) {
update(ctx, &uprobe_res);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | int handle_tp1(struct pt_regs *ctx) {
update(ctx, &tp_res);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | int handle_tp3(void *ctx) {
update(ctx, &tp_res);
return 1;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | int handle_pe(struct pt_regs *ctx) {
update(ctx, &pe_res);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_nf_fail.c | int alloc_release(struct __sk_buff *ctx) {
struct bpf_ct_opts___local opts = {};
struct bpf_sock_tuple tup = {};
struct nf_conn *ct;
ct = bpf_skb_ct_alloc(ctx, &tup, sizeof(tup.ipv4), &opts, sizeof(opts));
if (!ct)
return 0;
bpf_ct_release(ct);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_nf_fail.c | int insert_insert(struct __sk_buff *ctx) {
struct bpf_ct_opts___local opts = {};
struct bpf_sock_tuple tup = {};
struct nf_conn *ct;
ct = bpf_skb_ct_alloc(ctx, &tup, sizeof(tup.ipv4), &opts, sizeof(opts));
if (!ct)
return 0;
ct = bpf_ct_insert_entry(ct);
if (!ct)
return 0;
ct = bpf_ct_insert_en... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_bpf_nf_fail.c | int lookup_insert(struct __sk_buff *ctx) {
struct bpf_ct_opts___local opts = {};
struct bpf_sock_tuple tup = {};
struct nf_conn *ct;
ct = bpf_skb_ct_lookup(ctx, &tup, sizeof(tup.ipv4), &opts, sizeof(opts));
if (!ct)
return 0;
bpf_ct_insert_entry(ct);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_btf_decl_tag.c |
static __noinline int foo(int x __tag1 __tag2) __tag1 __tag2 {
struct key_t key;
value_t val = {};
key.a = key.b = key.c = x;
bpf_map_update_elem(&hashmap1, &key, &val, 0);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_btf_newkv.c | int test_long_fname_1(void) { return test_long_fname_2(); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_btf_newkv.c | int _dummy_tracepoint(void *arg) { return test_long_fname_1(); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_btf_nokv.c | int test_long_fname_1(void) { return test_long_fname_2(); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_btf_skc_cls_ingress.c | int cls_ingress(struct __sk_buff *skb) {
struct ipv6hdr *ip6h;
struct ethhdr *eth;
void *data_end;
data_end = (void *)(long)(skb->data_end);
eth = (struct ethhdr *)(long)(skb->data);
if (eth + 1 > data_end)
return TC_ACT_OK;
if (eth->h_proto != bpf_htons(ETH_P_IPV6))
return TC_ACT_OK;
ip6h =... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cgroup_link.c | int egress(struct __sk_buff *skb) {
__sync_fetch_and_add(&calls, 1);
return 1;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_check_mtu.c | int xdp_use_helper_basic(struct xdp_md *ctx) {
__u32 mtu_len = 0;
if (bpf_check_mtu(ctx, 0, &mtu_len, 0, 0))
return XDP_ABORTED;
return XDP_PASS;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_check_mtu.c | int xdp_use_helper(struct xdp_md *ctx) {
int retval = XDP_PASS;
__u32 mtu_len = 0;
__u32 ifindex = 0;
int delta = 0;
/* When ifindex is zero, save net_device lookup and use ctx netdev */
if (GLOBAL_USER_IFINDEX > 0)
ifindex = GLOBAL_USER_IFINDEX;
if (bpf_check_mtu(ctx, ifindex, &mtu_len, delta, 0)) ... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_check_mtu.c | int xdp_minus_delta(struct xdp_md *ctx) {
int retval = XDP_PASS;
void *data_end = (void *)(long)ctx->data_end;
void *data = (void *)(long)ctx->data;
__u32 ifindex = GLOBAL_USER_IFINDEX;
__u32 data_len = data_end - data;
__u32 mtu_len = 0;
int delta;
/* Borderline test case: Minus delta exceeding packet... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_check_mtu.c | int tc_exceed_mtu(struct __sk_buff *ctx) {
__u32 ifindex = GLOBAL_USER_IFINDEX;
int retval = BPF_DROP;
__u32 skb_len = ctx->len;
__u32 mtu_len = 0;
int delta;
int err;
/* Exceed MTU with 1 via delta adjust */
delta = GLOBAL_USER_MTU - (skb_len - ETH_HLEN) + 1;
err = bpf_check_mtu(ctx, ifindex, &mtu_... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c |
static __always_inline bool buf_copy(buf_t *buf, void *dst, size_t len) {
if (bpf_skb_load_bytes(buf->skb, buf_off(buf), dst, len)) {
return false;
}
buf->head += len;
return true;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c | static __always_inline bool buf_skip(buf_t *buf, const size_t len) {
if (buf_off(buf) + len > buf->skb->len) {
return false;
}
buf->head += len;
return true;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c |
static INLINING ret_t skip_next_hops(buf_t *pkt, int n) {
switch (n) {
case 1:
if (!buf_skip(pkt, sizeof(struct in_addr)))
return TC_ACT_SHOT;
case 0:
return CONTINUE_PROCESSING;
default:
return TC_ACT_SHOT;
}
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c | static INLINING uint64_t fill_tuple(struct bpf_sock_tuple *tuple, void *iph,
uint64_t iphlen, uint16_t sport,
uint16_t dport) {
switch (iphlen) {
case sizeof(struct iphdr): {
struct iphdr *ipv4 = (struct iphdr *)iph;
tuple->ipv4.daddr =... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c | static INLINING verdict_t process_icmpv4(buf_t *pkt, metrics_t *metrics) {
struct icmphdr icmp;
if (!buf_copy(pkt, &icmp, sizeof(icmp))) {
metrics->errors_total_malformed_icmp++;
return INVALID;
}
if (icmp.type == ICMP_ECHOREPLY) {
metrics->errors_total_icmp_echo_replies++;
return INVALID;
}
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c | static INLINING verdict_t process_icmpv6(buf_t *pkt, metrics_t *metrics) {
struct icmp6hdr icmp6;
if (!buf_copy(pkt, &icmp6, sizeof(icmp6))) {
metrics->errors_total_malformed_icmp++;
return INVALID;
}
if (icmp6.icmp6_type == ICMPV6_ECHO_REPLY) {
metrics->errors_total_icmp_echo_replies++;
return... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c |
static INLINING verdict_t process_udp(buf_t *pkt, void *iph, uint64_t iphlen,
metrics_t *metrics) {
metrics->l4_protocol_packets_total_udp++;
struct udphdr _udp;
struct udphdr *udph = buf_assign(pkt, sizeof(_udp), &_udp);
if (udph == NULL) {
metrics->errors_total_malf... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c |
static INLINING verdict_t process_ipv4(buf_t *pkt, metrics_t *metrics) {
metrics->l3_protocol_packets_total_ipv4++;
struct iphdr _ip4;
struct iphdr *ipv4 = pkt_parse_ipv4(pkt, &_ip4);
if (ipv4 == NULL) {
metrics->errors_total_malformed_ip++;
return INVALID;
}
if (ipv4->version != 4) {
metrics... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_cls_redirect.c |
static INLINING verdict_t process_ipv6(buf_t *pkt, metrics_t *metrics) {
metrics->l3_protocol_packets_total_ipv6++;
uint8_t l4_proto;
bool is_fragment;
struct ipv6hdr _ipv6;
struct ipv6hdr *ipv6 = pkt_parse_ipv6(pkt, &_ipv6, &l4_proto, &is_fragment);
if (ipv6 == NULL) {
metrics->errors_total_malformed... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_autosize.c | int handle_probed(void *ctx) {
struct test_struct___downsize *in = (void *)&input;
__u64 tmp;
tmp = 0;
bpf_core_read_int(&tmp, bpf_core_field_size(in->ptr), &in->ptr);
ptr_probed = tmp;
tmp = 0;
bpf_core_read_int(&tmp, bpf_core_field_size(in->val1), &in->val1);
val1_probed = tmp;
tmp = 0;
bpf_cor... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_autosize.c | int handle_signed(void *ctx) {
struct test_struct___signed *in = (void *)&input;
struct test_struct___signed *out = (void *)&output_signed;
val2_signed = in->val2;
val3_signed = in->val3;
val4_signed = in->val4;
out->val2 = in->val2;
out->val3 = in->val3;
out->val4 = in->val4;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_read_macros.c | int handler(void *ctx) {
int pid = bpf_get_current_pid_tgid() >> 32;
if (my_pid != pid)
return 0;
k_probe_in.next = &k_probe_in;
__builtin_preserve_access_index(({ k_core_in.next = &k_core_in; }));
k_probe_out = (long)BPF_PROBE_READ(&k_probe_in, next, next, func);
k_core_out = (long)BPF_CORE_READ(&k_... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_enum64val.c | int test_core_enum64val(void *ctx) {
#if __clang_major__ >= 15
struct core_reloc_enum64val_output *out = (void *)&data.out;
enum named_unsigned_enum64 named_unsigned = 0;
enum named_signed_enum64 named_signed = 0;
out->unsigned_val1_exists =
bpf_core_enum_value_exists(named_unsigned, UNSIGNED_ENUM64_VAL1... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_enumval.c | int test_core_enumval(void *ctx) {
#if __has_builtin(__builtin_preserve_enum_value)
struct core_reloc_enumval_output *out = (void *)&data.out;
enum named_enum named = 0;
anon_enum anon = 0;
out->named_val1_exists = bpf_core_enum_value_exists(named, NAMED_ENUM_VAL1);
out->named_val2_exists =
bpf_core_en... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_existence.c | int test_core_existence(void *ctx) {
struct core_reloc_existence *in = (void *)&data.in;
struct core_reloc_existence_output *out = (void *)&data.out;
out->a_exists = bpf_core_field_exists(in->a);
if (bpf_core_field_exists(struct core_reloc_existence, a))
out->a_value = BPF_CORE_READ(in, a);
else
out-... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_flavors.c | int test_core_flavors(void *ctx) {
struct core_reloc_flavors *in_orig = (void *)&data.in;
struct core_reloc_flavors___reversed *in_rev = (void *)&data.in;
struct core_reloc_flavors___weird *in_weird = (void *)&data.in;
struct core_reloc_flavors *out = (void *)&data.out;
if (CORE_READ(&out->a, &in_weird->a))
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_mods.c | int test_core_mods(void *ctx) {
struct core_reloc_mods *in = (void *)&data.in;
struct core_reloc_mods_output *out = (void *)&data.out;
if (CORE_READ(&out->a, &in->a) || CORE_READ(&out->b, &in->b) ||
CORE_READ(&out->c, &in->c) || CORE_READ(&out->d, &in->d) ||
CORE_READ(&out->e, &in->e[2]) || CORE_READ... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_module.c | int BPF_PROG(test_core_module_probed, struct task_struct *task,
struct bpf_testmod_test_read_ctx *read_ctx) {
#if __has_builtin(__builtin_preserve_enum_value)
struct core_reloc_module_output *out = (void *)&data.out;
__u64 pid_tgid = bpf_get_current_pid_tgid();
__u32 real_tgid = (__u32)(pid_tgid >> 3... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_primitives.c | int test_core_primitives(void *ctx) {
struct core_reloc_primitives *in = (void *)&data.in;
struct core_reloc_primitives *out = (void *)&data.out;
if (CORE_READ(&out->a, &in->a) || CORE_READ(&out->b, &in->b) ||
CORE_READ(&out->c, &in->c) || CORE_READ(&out->d, &in->d) ||
CORE_READ(&out->f, &in->f))
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_core_reloc_type_id.c | int test_core_type_id(void *ctx) {
#if __has_builtin(__builtin_preserve_type_info)
struct core_reloc_type_id_output *out = (void *)&data.out;
out->local_anon_struct = bpf_core_type_id_local(struct { int marker_field; });
out->local_anon_union = bpf_core_type_id_local(union { int marker_field; });
out->local_a... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_custom_sec_handlers.c | int xyz(void *ctx) {
int whatever;
bpf_copy_from_user(&whatever, sizeof(whatever), NULL);
xyz_called = true;
return 0;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_d_path.c | int BPF_PROG(prog_close, struct file *file, void *id) {
pid_t pid = bpf_get_current_pid_tgid() >> 32;
__u32 cnt = cnt_close;
int ret;
called_close = 1;
if (pid != my_pid)
return 0;
if (cnt >= MAX_FILES)
return 0;
ret = bpf_d_path(&file->f_path, paths_close[cnt], MAX_PATH_LEN);
rets_close[cnt... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_endian.c | int sys_enter(const void *ctx) {
out16 = __builtin_bswap16(in16);
out32 = __builtin_bswap32(in32);
out64 = __builtin_bswap64(in64);
const16 = ___bpf_swab16(IN16);
const32 = ___bpf_swab32(IN32);
const64 = ___bpf_swab64(IN64);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func1.c | int f1(struct __sk_buff *skb) {
volatile char buf[MAX_STACK] = {};
return f0(0, skb) + skb->len;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func11.c |
__noinline int foo(const struct S *s) {
return s ? bpf_get_prandom_u32() < s->x : 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func12.c |
__noinline int foo(const struct S *s) { return bpf_get_prandom_u32() < s->x; } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func17.c | int test_cls(struct __sk_buff *skb) { return foo((int *)&i); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func3.c | int f4(struct __sk_buff *skb) { return f3(1, skb, 2); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func3.c | int f8(struct __sk_buff *skb) { return f7(skb); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func6.c | int f2(int val, struct __sk_buff *skb) { return f1(skb) + f3(val, skb + 1); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func9.c | __noinline int baz(volatile int *x) {
if (x)
*x &= bpf_get_prandom_u32();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func9.c |
__noinline int quuz(int **p) {
if (p)
*p = NULL;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func_args.c |
__noinline int bar(__u32 index, volatile struct S *s) {
if (s) {
save_value(index, s->v);
return ++s->v;
}
save_value(index, 0);
return 1;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_global_func_args.c |
__noinline int baz(struct S **s) {
if (s)
*s = 0;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_helper_restricted.c |
static void spin_lock_work(void) {
const int key = 0;
struct lock *lock;
lock = bpf_map_lookup_elem(&locks, &key);
if (lock) {
bpf_spin_lock(&lock->l);
bpf_spin_unlock(&lock->l);
}
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_helper_restricted.c | int tp_timer(void *ctx) {
timer_work();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_helper_restricted.c | int kprobe_timer(void *ctx) {
timer_work();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_helper_restricted.c | int raw_tp_spin_lock(void *ctx) {
spin_lock_work();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_helper_restricted.c | int kprobe_spin_lock(void *ctx) {
spin_lock_work();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_jhash.h |
static __always_inline u32 rol32(u32 word, unsigned int shift) {
return (word << shift) | (word >> ((-shift) & 31));
}
#define __jhash_mix(a, b, c) \
{ \
a -= c; ... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c | int BPF_PROG(not_ptr_to_stack, int cmd, union bpf_attr *attr,
unsigned int size) {
unsigned long val;
return bpf_verify_pkcs7_signature((struct bpf_dynptr *)val,
(struct bpf_dynptr *)val, NULL);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_ksyms_btf_write_check.c |
__noinline int write_active(int *p) { return p ? (*p = 42) : 0; } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_ksyms_btf_write_check.c | int handler2(const void *ctx) {
int *active;
__u32 cpu;
active = bpf_this_cpu_ptr(&bpf_prog_active);
write_active(active);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_ksyms_weak.c | int pass_handler(const void *ctx) {
struct rq *rq;
rq = (struct rq *)bpf_per_cpu_ptr(&runqueues, 0);
if (rq)
out__existing_typed = rq->cpu;
out__existing_typeless = (__u64)&bpf_prog_active;
/* tests non-existent symbols. */
out__non_existent_typeless = (__u64)&bpf_link_fops1;
/* tests non-existent ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb.c | static inline __u32 rol32(__u32 word, unsigned int shift) {
return (word << shift) | (word >> ((-shift) & 31));
}
#define __jhash_mix(a, b, c) \
{ \
a -= c; ... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb.c |
static __always_inline bool get_packet_dst(struct real_definition **real,
struct packet_description *pckt,
struct vip_meta *vip_info,
bool is_ipv6) {
__u32 hash = get_packet_hash(pckt, is_... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb.c |
static __always_inline int parse_icmp(void *data, void *data_end, __u64 off,
struct packet_description *pckt) {
struct icmphdr *icmp_hdr;
struct iphdr *iph;
icmp_hdr = data + off;
if (icmp_hdr + 1 > data_end)
return TC_ACT_SHOT;
if (icmp_hdr->type != ICMP_DEST_UNREA... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb.c |
static __always_inline bool parse_udp(void *data, __u64 off, void *data_end,
struct packet_description *pckt) {
struct udphdr *udp;
udp = data + off;
if (udp + 1 > data_end)
return false;
if (!(pckt->flags & F_ICMP)) {
pckt->port16[0] = udp->source;
pckt->por... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb.c |
static __always_inline bool parse_tcp(void *data, __u64 off, void *data_end,
struct packet_description *pckt) {
struct tcphdr *tcp;
tcp = data + off;
if (tcp + 1 > data_end)
return false;
if (tcp->syn)
pckt->flags |= F_SYN_SET;
if (!(pckt->flags & F_ICMP)) {
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_l4lb_noinline.c |
static __noinline __u32 get_packet_hash(struct packet_description *pckt,
bool ipv6) {
if (ipv6)
return jhash_2words(jhash(pckt->srcv6, 16, MAX_VIPS), pckt->ports,
CH_RINGS_SIZE);
else
return jhash_2words(pckt->src, pckt->ports, CH_RINGS_SIZE);... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_link_pinning.c | int raw_tp_prog(const void *ctx) {
out = in;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/progs/test_log_buf.c | int bad_prog(const void *ctx) { return a[off]; } | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.