| /tools/testing/selftests/bpf/progs/ |
| A D | test_tcp_custom_syncookie.c | 75 ctx->data = (void *)(long)ctx->skb->data; in tcp_load_headers() 79 if (ctx->eth + 1 > ctx->data_end) in tcp_load_headers() 86 if (ctx->ipv4 + 1 > ctx->data_end) in tcp_load_headers() 103 if (ctx->ipv6 + 1 > ctx->data_end) in tcp_load_headers() 118 if (ctx->tcp + 1 > ctx->data_end) in tcp_load_headers() 286 ctx->off = (__u8 *)(ctx->tcp + 1) - (__u8 *)ctx->data, in tcp_parse_options() 308 if (!ctx->tcp->ece || !ctx->tcp->cwr) in tcp_validate_sysctl() 360 if (ctx->attrs.tstamp_ok && ctx->tcp->ece && ctx->tcp->cwr) in tcp_prepare_cookie() 420 ctx->tcp->doff = ((long)ctx->ptr32 - (long)ctx->tcp) >> 2; in tcp_handle_syn() 422 if (!ctx->attrs.tstamp_ok || !ctx->tcp->ece || !ctx->tcp->cwr) in tcp_handle_syn() [all …]
|
| A D | test_sk_lookup.c | 304 if (ctx->sk != sk) in sk_assign_null() 333 if (ctx->sk && ctx->sk->family != AF_INET) in access_ctx_sk() 356 if (ctx->sk) in access_ctx_sk() 401 LSB(ctx->family, 1) != 0 || LSB(ctx->family, 2) != 0 || LSB(ctx->family, 3) != 0) in ctx_narrow_access() 408 LSB(ctx->protocol, 1) != 0 || LSB(ctx->protocol, 2) != 0 || LSB(ctx->protocol, 3) != 0) in ctx_narrow_access() 434 LSB(ctx->local_port, 2) != 0 || LSB(ctx->local_port, 3) != 0) in ctx_narrow_access() 463 LSB(ctx->remote_ip4, 2) != 0 || LSB(ctx->remote_ip4, 3) != 0) in ctx_narrow_access() 465 if (LSW(ctx->remote_ip4, 0) != 0 || LSW(ctx->remote_ip4, 1) != 0) in ctx_narrow_access() 468 if (LSB(ctx->local_ip4, 0) != 0 || LSB(ctx->local_ip4, 1) != 0 || in ctx_narrow_access() 469 LSB(ctx->local_ip4, 2) != 0 || LSB(ctx->local_ip4, 3) != 0) in ctx_narrow_access() [all …]
|
| A D | test_global_func_ctx_args.c | 24 int kprobe_typedef_ctx(void *ctx) in kprobe_typedef_ctx() argument 55 int kprobe_resolved_ctx(void *ctx) in kprobe_resolved_ctx() argument 88 int raw_tp_ctx(void *ctx) in raw_tp_ctx() argument 90 return raw_tp_ctx_subprog(ctx); in raw_tp_ctx() 120 int perf_event_ctx(void *ctx) in perf_event_ctx() argument 149 int arg_tag_ctx_raw_tp(void *ctx) in arg_tag_ctx_raw_tp() argument 153 return subprog_ctx_tag(ctx) + subprog_multi_ctx_tags(ctx, &x, ctx); in arg_tag_ctx_raw_tp() 158 int arg_tag_ctx_perf(void *ctx) in arg_tag_ctx_perf() argument 162 return subprog_ctx_tag(ctx) + subprog_multi_ctx_tags(ctx, &x, ctx); in arg_tag_ctx_perf() 167 int arg_tag_ctx_kprobe(void *ctx) in arg_tag_ctx_kprobe() argument [all …]
|
| A D | sockopt_sk.c | 38 sk = ctx->sk; in _getsockopt() 50 if (ctx->level == SOL_IP && ctx->optname == IP_TOS) { in _getsockopt() 58 if (ctx->level == SOL_SOCKET && ctx->optname == SO_SNDBUF) { in _getsockopt() 66 if (ctx->level == SOL_TCP && ctx->optname == TCP_CONGESTION) { in _getsockopt() 90 if (ctx->level == SOL_IP && ctx->optname == IP_FREEBIND) { in _getsockopt() 128 ctx->optlen = 1; in _getsockopt() 148 sk = ctx->sk; in _setsockopt() 160 if (ctx->level == SOL_IP && ctx->optname == IP_TOS) { in _setsockopt() 169 if (ctx->level == SOL_SOCKET && ctx->optname == SO_SNDBUF) { in _setsockopt() 181 if (ctx->level == SOL_TCP && ctx->optname == TCP_CONGESTION) { in _setsockopt() [all …]
|
| A D | sendmsg6_prog.c | 31 int sendmsg_v6_prog(struct bpf_sock_addr *ctx) in sendmsg_v6_prog() argument 33 if (ctx->type != SOCK_DGRAM) in sendmsg_v6_prog() 36 if (!get_set_sk_priority(ctx)) in sendmsg_v6_prog() 40 if (ctx->msg_src_ip6[3] == bpf_htonl(1) || in sendmsg_v6_prog() 41 ctx->msg_src_ip6[3] == bpf_htonl(0)) { in sendmsg_v6_prog() 58 ctx->user_port = bpf_htons(DST_REWRITE_PORT6); in sendmsg_v6_prog() 82 ctx->user_port = bpf_htons(DST_REWRITE_PORT6); in sendmsg_v6_v4mapped_prog() 97 ctx->user_ip6[0] = bpf_htonl(0); in sendmsg_v6_wildcard_prog() 98 ctx->user_ip6[1] = bpf_htonl(0); in sendmsg_v6_wildcard_prog() 99 ctx->user_ip6[2] = bpf_htonl(0); in sendmsg_v6_wildcard_prog() [all …]
|
| A D | verifier_global_subprogs.c | 193 return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); in arg_tag_ctx_raw_tp() 200 return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); in arg_tag_ctx_raw_tp_writable() 207 return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); in arg_tag_ctx_raw_tp_btf() 221 return subprog_ctx_tag(ctx) + tp_whatever(ctx); in arg_tag_ctx_tp() 293 return (iter_subprog_void(ctx) + iter_subprog_typed(ctx)) & 1; in arg_tag_ctx_iter_task() 312 acc += tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); in BPF_PROG() 320 acc += tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); in BPF_PROG() 328 return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); in BPF_PROG() 337 ret = tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); in BPF_PROG() 346 return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); in BPF_PROG() [all …]
|
| A D | verifier_sock_addr.c | 11 int recvmsg4_good_return_code(struct bpf_sock_addr *ctx) in recvmsg4_good_return_code() argument 18 int recvmsg4_bad_return_code(struct bpf_sock_addr *ctx) in recvmsg4_bad_return_code() argument 25 int recvmsg6_good_return_code(struct bpf_sock_addr *ctx) in recvmsg6_good_return_code() argument 32 int recvmsg6_bad_return_code(struct bpf_sock_addr *ctx) in recvmsg6_bad_return_code() argument 53 int sendmsg4_good_return_code_0(struct bpf_sock_addr *ctx) in sendmsg4_good_return_code_0() argument 60 int sendmsg4_good_return_code_1(struct bpf_sock_addr *ctx) in sendmsg4_good_return_code_1() argument 67 int sendmsg4_bad_return_code(struct bpf_sock_addr *ctx) in sendmsg4_bad_return_code() argument 88 int sendmsg6_bad_return_code(struct bpf_sock_addr *ctx) in sendmsg6_bad_return_code() argument 200 int bind4_good_return_code_0(struct bpf_sock_addr *ctx) in bind4_good_return_code_0() argument 228 int bind4_bad_return_code(struct bpf_sock_addr *ctx) in bind4_bad_return_code() argument [all …]
|
| A D | sockopt_multi.c | 14 __u8 *optval = ctx->optval; in _getsockopt_child() 16 if (ctx->level != SOL_IP || ctx->optname != IP_TOS) in _getsockopt_child() 28 ctx->optlen = 1; in _getsockopt_child() 35 ctx->optlen = 0; in _getsockopt_child() 43 __u8 *optval = ctx->optval; in _getsockopt_parent() 45 if (ctx->level != SOL_IP || ctx->optname != IP_TOS) in _getsockopt_parent() 57 ctx->optlen = 1; in _getsockopt_parent() 64 ctx->optlen = 0; in _getsockopt_parent() 74 if (ctx->level != SOL_IP || ctx->optname != IP_TOS) in _setsockopt() 81 ctx->optlen = 1; in _setsockopt() [all …]
|
| A D | bind6_prog.c | 70 if (bpf_setsockopt(ctx, SOL_SOCKET, SO_REUSEPORT, in bind_reuseport() 107 int bind_v6_prog(struct bpf_sock_addr *ctx) in bind_v6_prog() argument 114 sk = ctx->sk; in bind_v6_prog() 121 if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM) in bind_v6_prog() 128 ctx->user_port != bpf_htons(SERV6_PORT)) in bind_v6_prog() 138 if (ctx->user_ip6[i] != user_ip6) in bind_v6_prog() 145 if (ctx->user_port != user_port) in bind_v6_prog() 153 if (ctx->user_ip6[i] != user_ip6) in bind_v6_prog() 158 if (bind_to_device(ctx)) in bind_v6_prog() 162 if (misc_opts(ctx, SO_MARK) || misc_opts(ctx, SO_PRIORITY)) in bind_v6_prog() [all …]
|
| A D | bind4_prog.c | 101 int bind_v4_prog(struct bpf_sock_addr *ctx) in bind_v4_prog() argument 107 sk = ctx->sk; in bind_v4_prog() 114 if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM) in bind_v4_prog() 117 if (ctx->user_ip4 != bpf_htonl(SERV4_IP) || in bind_v4_prog() 118 ctx->user_port != bpf_htons(SERV4_PORT)) in bind_v4_prog() 127 if (ctx->user_ip4 != user_ip4) in bind_v4_prog() 133 if (ctx->user_port != user_port) in bind_v4_prog() 140 if (ctx->user_ip4 != user_ip4) in bind_v4_prog() 144 if (bind_to_device(ctx)) in bind_v4_prog() 148 if (misc_opts(ctx, SO_MARK) || misc_opts(ctx, SO_PRIORITY)) in bind_v4_prog() [all …]
|
| A D | connect_force_port6.c | 49 orig->addr[0] = ctx->user_ip6[0]; in connect6() 53 orig->port = ctx->user_port; in connect6() 55 ctx->user_ip6[0] = 0; in connect6() 56 ctx->user_ip6[1] = 0; in connect6() 57 ctx->user_ip6[2] = 0; in connect6() 58 ctx->user_ip6[3] = bpf_htonl(1); in connect6() 67 if (!get_set_sk_priority(ctx)) in getsockname6() 73 ctx->user_ip6[1] = 0; in getsockname6() 74 ctx->user_ip6[2] = 0; in getsockname6() 86 if (!get_set_sk_priority(ctx)) in getpeername6() [all …]
|
| A D | string_kfuncs_failure1.c | 32 SEC("syscall") __retval(USER_PTR_ERR) int test_strcmp_null1(void *ctx) { return bpf_strcmp(NULL, "h… in __retval() 33 SEC("syscall") __retval(USER_PTR_ERR)int test_strcmp_null2(void *ctx) { return bpf_strcmp("hello",… in __retval() 34 SEC("syscall") __retval(USER_PTR_ERR)int test_strchr_null(void *ctx) { return bpf_strchr(NULL, 'a'… in __retval() 35 SEC("syscall") __retval(USER_PTR_ERR)int test_strchrnul_null(void *ctx) { return bpf_strchrnul(NUL… in __retval() 36 SEC("syscall") __retval(USER_PTR_ERR)int test_strnchr_null(void *ctx) { return bpf_strnchr(NULL, 1… in __retval() 37 SEC("syscall") __retval(USER_PTR_ERR)int test_strrchr_null(void *ctx) { return bpf_strrchr(NULL, '… in __retval() 38 SEC("syscall") __retval(USER_PTR_ERR)int test_strlen_null(void *ctx) { return bpf_strlen(NULL); } in __retval() 39 SEC("syscall") __retval(USER_PTR_ERR)int test_strnlen_null(void *ctx) { return bpf_strnlen(NULL, 1… in __retval() 40 SEC("syscall") __retval(USER_PTR_ERR)int test_strspn_null1(void *ctx) { return bpf_strspn(NULL, "h… in __retval() 41 SEC("syscall") __retval(USER_PTR_ERR)int test_strspn_null2(void *ctx) { return bpf_strspn("hello",… in __retval() [all …]
|
| A D | connect4_prog.c | 38 int do_bind(struct bpf_sock_addr *ctx) in do_bind() argument 78 if (verify_cc(ctx, reno)) in set_cc() 83 if (verify_cc(ctx, cubic)) in set_cc() 118 if (ctx->type == SOCK_STREAM) { in set_keepalive() 140 if (ctx->type == SOCK_STREAM) { in set_notsent_lowat() 162 if (bind_to_device(ctx)) in connect_v4_prog() 165 if (set_keepalive(ctx)) in connect_v4_prog() 168 if (set_notsent_lowat(ctx)) in connect_v4_prog() 171 if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM) in connect_v4_prog() 192 if (ctx->type == SOCK_STREAM && set_cc(ctx)) in connect_v4_prog() [all …]
|
| A D | test_bpf_cookie.c | 36 update(ctx, &kprobe_res); in handle_kprobe() 50 update(ctx, &uprobe_res); in handle_uprobe() 69 update(ctx, &tp_res); in handle_tp1() 75 update(ctx, &tp_res); in handle_tp2() 79 int handle_tp3(void *ctx) in handle_tp3() argument 81 update(ctx, &tp_res); in handle_tp3() 88 update(ctx, &pe_res); in handle_pe() 95 update(ctx, &raw_tp_res); in handle_raw_tp() 102 update(ctx, &tp_btf_res); in handle_tp_btf() 116 update(ctx, &fexit_res); in BPF_PROG() [all …]
|
| A D | string_kfuncs_success.c | 13 __test(0) int test_strcmp_eq(void *ctx) { return bpf_strcmp(str, "hello world"); } in test_strcmp_eq() argument 14 __test(1) int test_strcmp_neq(void *ctx) { return bpf_strcmp(str, "hello"); } in test_strcmp_neq() argument 15 __test(1) int test_strchr_found(void *ctx) { return bpf_strchr(str, 'e'); } in test_strchr_found() argument 16 __test(11) int test_strchr_null(void *ctx) { return bpf_strchr(str, '\0'); } in test_strchr_null() argument 23 __test(9) int test_strrchr_found(void *ctx) { return bpf_strrchr(str, 'l'); } in test_strrchr_found() argument 24 __test(11) int test_strrchr_null(void *ctx) { return bpf_strrchr(str, '\0'); } in test_strrchr_null() argument 26 __test(11) int test_strlen(void *ctx) { return bpf_strlen(str); } in test_strlen() argument 27 __test(11) int test_strnlen(void *ctx) { return bpf_strnlen(str, 12); } in test_strnlen() argument 28 __test(5) int test_strspn(void *ctx) { return bpf_strspn(str, "ehlo"); } in test_strspn() argument 29 __test(2) int test_strcspn(void *ctx) { return bpf_strcspn(str, "lo"); } in test_strcspn() argument [all …]
|
| A D | sockopt_inherit.c | 57 __u8 *optval = ctx->optval; in _getsockopt() 59 if (ctx->level != SOL_CUSTOM) in _getsockopt() 65 storage = get_storage(ctx); in _getsockopt() 72 ctx->optlen = 1; in _getsockopt() 78 if (ctx->optlen > page_size) in _getsockopt() 79 ctx->optlen = 0; in _getsockopt() 88 __u8 *optval = ctx->optval; in _setsockopt() 96 storage = get_storage(ctx); in _setsockopt() 101 ctx->optlen = -1; in _setsockopt() 107 if (ctx->optlen > page_size) in _setsockopt() [all …]
|
| A D | connect_force_port4.c | 30 int connect4(struct bpf_sock_addr *ctx) in connect4() argument 50 orig->addr = ctx->user_ip4; in connect4() 51 orig->port = ctx->user_port; in connect4() 53 ctx->user_ip4 = bpf_htonl(0x7f000001); in connect4() 54 ctx->user_port = bpf_htons(60123); in connect4() 62 if (!get_set_sk_priority(ctx)) in getsockname4() 67 ctx->user_ip4 = bpf_htonl(0x01020304); in getsockname4() 68 ctx->user_port = bpf_htons(60000); in getsockname4() 78 if (!get_set_sk_priority(ctx)) in getpeername4() 85 ctx->user_ip4 = orig->addr; in getpeername4() [all …]
|
| A D | exceptions_fail.c | 112 if (ctx->len) in subprog_lock() 119 int reject_with_lock(void *ctx) in reject_with_lock() argument 130 return subprog_lock(ctx); in reject_subprog_with_lock() 144 if (ctx->len) in throwing_subprog() 154 return throwing_subprog(ctx); in reject_subprog_with_rcu_read_lock() 224 int reject_with_cb(void *ctx) in reject_with_cb() argument 234 return subprog_ref(ctx) + 1; in reject_with_subprog_reference() 255 return exception_cb1(ctx->tstamp); in static_func() 276 return global_func(ctx); in __exception_cb() 284 return static_func(ctx); in __exception_cb() [all …]
|
| /tools/perf/tests/ |
| A D | expr.c | 87 ctx = expr__ctx_new(); in test__expr() 120 expr__ctx_free(ctx); in test__expr() 133 expr__ctx_clear(ctx); in test__expr() 136 ctx) == 0); in test__expr() 142 expr__ctx_clear(ctx); in test__expr() 146 NULL, ctx) == 0); in test__expr() 151 expr__ctx_clear(ctx); in test__expr() 168 NULL, ctx) == 0); in test__expr() 188 NULL, ctx) == 0); in test__expr() 266 NULL, ctx) == 0); in test__expr() [all …]
|
| /tools/testing/selftests/filesystems/epoll/ |
| A D | epoll_wakeup_test.c | 1688 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 1792 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 1906 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 2020 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 2124 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 2228 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 2337 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 2446 EXPECT_TRUE((ctx.count == 2) || (ctx.count == 3)); in TEST() 3265 __atomic_fetch_sub(&ctx.ready, ARRAY_SIZE(ctx.evfd), in TEST() 3269 while (count_waiters(&ctx) != ARRAY_SIZE(ctx.evfd)) in TEST() [all …]
|
| /tools/testing/selftests/sgx/ |
| A D | sigstruct.c | 38 BN_free(ctx->m); in free_q1q2_ctx() 39 BN_free(ctx->s); in free_q1q2_ctx() 40 BN_free(ctx->q1); in free_q1q2_ctx() 55 if (!ctx->bn_ctx || !ctx->s || !ctx->m || !ctx->q1 || !ctx->qr || in alloc_q1q2_ctx() 56 !ctx->q2) { in alloc_q1q2_ctx() 91 if (!BN_mul(ctx.q1, ctx.s, ctx.s, ctx.bn_ctx)) in calc_q1q2() 94 if (!BN_div(ctx.q1, ctx.qr, ctx.q1, ctx.m, ctx.bn_ctx)) in calc_q1q2() 103 if (!BN_mul(ctx.q2, ctx.s, ctx.qr, ctx.bn_ctx)) in calc_q1q2() 106 if (!BN_div(ctx.q2, NULL, ctx.q2, ctx.m, ctx.bn_ctx)) in calc_q1q2() 349 if (!ctx) in encl_measure() [all …]
|
| /tools/testing/selftests/perf_events/ |
| A D | sigtrap_threads.c | 44 } ctx; variable 124 memset(&ctx, 0, sizeof(ctx)); in FIXTURE_SETUP() 173 EXPECT_EQ(ctx.first_siginfo.si_addr, &ctx.iterate_on); in TEST_F() 178 ctx.iterate_on = 0; in TEST_F() 192 EXPECT_EQ(ctx.first_siginfo.si_addr, &ctx.iterate_on); in TEST_F() 197 ctx.iterate_on = 0; in TEST_F() 210 EXPECT_EQ(ctx.signal_count, NUM_THREADS * ctx.iterate_on); in TEST_F() 212 EXPECT_EQ(ctx.first_siginfo.si_addr, &ctx.iterate_on); in TEST_F() 222 ctx.iterate_on = -1; in TEST_F() 230 ctx.iterate_on = 0; in TEST_F() [all …]
|
| /tools/testing/selftests/bpf/prog_tests/ |
| A D | free_timer.c | 21 ctx->start = true; in start_threads() 26 ctx->stop = true; in stop_threads() 36 return ctx->stop; in wait_for_start() 57 loop = ctx->loop; in overwrite_timer_fn() 96 loop = ctx->loop; in start_timer_fn() 121 struct run_ctx ctx; in test_free_timer() local 130 memset(&ctx, 0, sizeof(ctx)); in test_free_timer() 135 ctx.start_prog = prog; in test_free_timer() 143 ctx.loop = 10; in test_free_timer() 151 stop_threads(&ctx); in test_free_timer() [all …]
|
| /tools/testing/selftests/bpf/benchs/ |
| A D | bench_bloom_filter_map.c | 11 static struct ctx { struct 29 } ctx = { argument 159 if (ctx.use_hashmap) { in map_prepare_thread() 183 if (ctx.use_hashmap && !ctx.hashmap_use_bloom) in map_prepare_thread() 196 ctx.map_done = true; in map_prepare_thread() 212 ctx.bloom_fd = bpf_map__fd(ctx.skel->maps.bloom_map); in populate_maps() 213 ctx.hashmap_fd = bpf_map__fd(ctx.skel->maps.hashmap); in populate_maps() 214 ctx.array_map_fd = bpf_map__fd(ctx.skel->maps.array_map); in populate_maps() 226 while (!ctx.map_done) in populate_maps() 227 pthread_cond_wait(&ctx.map_done_cv, &ctx.map_done_mtx); in populate_maps() [all …]
|
| /tools/testing/selftests/lsm/ |
| A D | lsm_get_self_attr_test.c | 37 free(ctx); in TEST() 72 free(ctx); in TEST() 113 free(ctx); in TEST() 137 free(ctx); in TEST() 191 tctx = ctx; in TEST() 204 tctx = ctx; in TEST() 218 tctx = ctx; in TEST() 232 tctx = ctx; in TEST() 246 tctx = ctx; in TEST() 260 tctx = ctx; in TEST() [all …]
|