/linux-6.1.9/tools/testing/selftests/bpf/prog_tests/ |
D | cgroup_getset_retval.c | 19 static void test_setsockopt_set(int cgroup_fd, int sock_fd) in test_setsockopt_set() argument 32 cgroup_fd); in test_setsockopt_set() 53 static void test_setsockopt_set_and_get(int cgroup_fd, int sock_fd) in test_setsockopt_set_and_get() argument 66 cgroup_fd); in test_setsockopt_set_and_get() 70 cgroup_fd); in test_setsockopt_set_and_get() 94 static void test_setsockopt_default_zero(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero() argument 107 cgroup_fd); in test_setsockopt_default_zero() 128 static void test_setsockopt_default_zero_and_set(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero_and_set() argument 142 cgroup_fd); in test_setsockopt_default_zero_and_set() 146 cgroup_fd); in test_setsockopt_default_zero_and_set() [all …]
|
D | lsm_cgroup.c | 19 static __u32 query_prog_cnt(int cgroup_fd, const char *attach_func) in query_prog_cnt() argument 25 ASSERT_OK(bpf_prog_query_opts(cgroup_fd, BPF_LSM_CGROUP, &p), "prog_query"); in query_prog_cnt() 41 ASSERT_OK(bpf_prog_query_opts(cgroup_fd, BPF_LSM_CGROUP, &p), "prog_query"); in query_prog_cnt() 68 int cgroup_fd = -1, cgroup_fd2 = -1, cgroup_fd3 = -1; in test_lsm_cgroup_functional() local 90 cgroup_fd = test__join_cgroup("/sock_policy"); in test_lsm_cgroup_functional() 91 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup")) in test_lsm_cgroup_functional() 105 ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_security"), 0, "prog count"); in test_lsm_cgroup_functional() 106 ASSERT_EQ(query_prog_cnt(cgroup_fd, NULL), 0, "total prog count"); in test_lsm_cgroup_functional() 107 err = bpf_prog_attach(alloc_prog_fd, cgroup_fd, BPF_LSM_CGROUP, 0); in test_lsm_cgroup_functional() 114 ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_security"), 1, "prog count"); in test_lsm_cgroup_functional() [all …]
|
D | cgroup_v1v2.c | 10 static int run_test(int cgroup_fd, int server_fd, bool classid) in run_test() argument 24 cgroup_fd); in run_test() 48 int server_fd, client_fd, cgroup_fd; in test_cgroup_v1v2() local 64 cgroup_fd = test__join_cgroup("/connect_dropper"); in test_cgroup_v1v2() 65 if (!ASSERT_GE(cgroup_fd, 0, "cgroup_fd")) in test_cgroup_v1v2() 69 close(cgroup_fd); in test_cgroup_v1v2() 72 ASSERT_OK(run_test(cgroup_fd, server_fd, false), "cgroup-v2-only"); in test_cgroup_v1v2() 75 ASSERT_OK(run_test(cgroup_fd, server_fd, true), "cgroup-v1v2"); in test_cgroup_v1v2() 78 close(cgroup_fd); in test_cgroup_v1v2()
|
D | connect_force_port.c | 49 static int run_test(int cgroup_fd, int server_fd, int family, int type) in run_test() argument 78 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test() 94 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test() 110 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test() 135 int server_fd, cgroup_fd; in test_connect_force_port() local 137 cgroup_fd = test__join_cgroup("/connect_force_port"); in test_connect_force_port() 138 if (CHECK_FAIL(cgroup_fd < 0)) in test_connect_force_port() 144 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_STREAM)); in test_connect_force_port() 150 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET6, SOCK_STREAM)); in test_connect_force_port() 156 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_DGRAM)); in test_connect_force_port() [all …]
|
D | connect_ping.c | 20 static void subtest(int cgroup_fd, struct connect_ping *skel, in subtest() argument 99 int cgroup_fd; in test_connect_ping() local 126 cgroup_fd = test__join_cgroup("/connect_ping"); in test_connect_ping() 127 if (!ASSERT_GE(cgroup_fd, 0, "cg-create")) in test_connect_ping() 134 bpf_program__attach_cgroup(skel->progs.connect_v4_prog, cgroup_fd); in test_connect_ping() 138 bpf_program__attach_cgroup(skel->progs.connect_v6_prog, cgroup_fd); in test_connect_ping() 147 subtest(cgroup_fd, skel, AF_INET, 0); in test_connect_ping() 154 subtest(cgroup_fd, skel, AF_INET, 1); in test_connect_ping() 161 subtest(cgroup_fd, skel, AF_INET6, 0); in test_connect_ping() 168 subtest(cgroup_fd, skel, AF_INET6, 1); in test_connect_ping() [all …]
|
D | udp_limit.c | 12 int cgroup_fd; in test_udp_limit() local 14 cgroup_fd = test__join_cgroup("/udp_limit"); in test_udp_limit() 15 if (!ASSERT_GE(cgroup_fd, 0, "cg-join")) in test_udp_limit() 22 skel->links.sock = bpf_program__attach_cgroup(skel->progs.sock, cgroup_fd); in test_udp_limit() 25 skel->links.sock_release = bpf_program__attach_cgroup(skel->progs.sock_release, cgroup_fd); in test_udp_limit() 69 close(cgroup_fd); in test_udp_limit()
|
D | sockopt_inherit.c | 135 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title, in prog_attach() argument 155 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach() 165 static void run_test(int cgroup_fd) in run_test() argument 181 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt", "_getsockopt"); in run_test() 185 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt", "_setsockopt"); in run_test() 225 int cgroup_fd; in test_sockopt_inherit() local 227 cgroup_fd = test__join_cgroup("/sockopt_inherit"); in test_sockopt_inherit() 228 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup")) in test_sockopt_inherit() 231 run_test(cgroup_fd); in test_sockopt_inherit() 232 close(cgroup_fd); in test_sockopt_inherit()
|
D | mptcp.c | 94 static int run_test(int cgroup_fd, int server_fd, bool is_mptcp) in run_test() argument 119 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test() 141 int server_fd, cgroup_fd; in test_base() local 143 cgroup_fd = test__join_cgroup("/mptcp"); in test_base() 144 if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup")) in test_base() 152 ASSERT_OK(run_test(cgroup_fd, server_fd, false), "run_test tcp"); in test_base() 162 ASSERT_OK(run_test(cgroup_fd, server_fd, true), "run_test mptcp"); in test_base() 167 close(cgroup_fd); in test_base()
|
D | socket_cookie.c | 18 int server_fd = 0, client_fd = 0, cgroup_fd = 0, err = 0; in test_socket_cookie() local 29 cgroup_fd = test__join_cgroup("/socket_cookie"); in test_socket_cookie() 30 if (CHECK(cgroup_fd < 0, "join_cgroup", "cgroup creation failed\n")) in test_socket_cookie() 34 skel->progs.set_cookie, cgroup_fd); in test_socket_cookie() 39 skel->progs.update_cookie_sockops, cgroup_fd); in test_socket_cookie() 73 close(cgroup_fd); in test_socket_cookie()
|
D | tcp_rtt.c | 90 static int run_test(int cgroup_fd, int server_fd) in run_test() argument 105 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test() 148 int server_fd, cgroup_fd; in test_tcp_rtt() local 150 cgroup_fd = test__join_cgroup("/tcp_rtt"); in test_tcp_rtt() 151 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup /tcp_rtt")) in test_tcp_rtt() 158 ASSERT_OK(run_test(cgroup_fd, server_fd), "run_test"); in test_tcp_rtt() 163 close(cgroup_fd); in test_tcp_rtt()
|
D | bind_perm.c | 57 int cgroup_fd; in test_bind_perm() local 62 cgroup_fd = test__join_cgroup("/bind_perm"); in test_bind_perm() 63 if (CHECK(cgroup_fd < 0, "cg-join", "errno %d", errno)) in test_bind_perm() 70 skel->links.bind_v4_prog = bpf_program__attach_cgroup(skel->progs.bind_v4_prog, cgroup_fd); in test_bind_perm() 74 skel->links.bind_v6_prog = bpf_program__attach_cgroup(skel->progs.bind_v6_prog, cgroup_fd); in test_bind_perm() 94 close(cgroup_fd); in test_bind_perm()
|
D | netns_cookie.c | 15 int server_fd = -1, client_fd = -1, cgroup_fd = -1; in test_netns_cookie() local 26 cgroup_fd = test__join_cgroup("/netns_cookie"); in test_netns_cookie() 27 if (CHECK(cgroup_fd < 0, "join_cgroup", "cgroup creation failed\n")) in test_netns_cookie() 31 skel->progs.get_netns_cookie_sockops, cgroup_fd); in test_netns_cookie() 77 if (cgroup_fd != -1) in test_netns_cookie() 78 close(cgroup_fd); in test_netns_cookie()
|
D | load_bytes_relative.c | 12 int server_fd, cgroup_fd, prog_fd, map_fd, client_fd; in test_load_bytes_relative() local 22 cgroup_fd = test__join_cgroup("/load_bytes_relative"); in test_load_bytes_relative() 23 if (CHECK_FAIL(cgroup_fd < 0)) in test_load_bytes_relative() 47 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, in test_load_bytes_relative() 70 close(cgroup_fd); in test_load_bytes_relative()
|
D | sockopt_sk.c | 195 static void run_test(int cgroup_fd) in run_test() argument 206 bpf_program__attach_cgroup(skel->progs._setsockopt, cgroup_fd); in run_test() 211 bpf_program__attach_cgroup(skel->progs._getsockopt, cgroup_fd); in run_test() 223 int cgroup_fd; in test_sockopt_sk() local 225 cgroup_fd = test__join_cgroup("/sockopt_sk"); in test_sockopt_sk() 226 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup /sockopt_sk")) in test_sockopt_sk() 229 run_test(cgroup_fd); in test_sockopt_sk() 230 close(cgroup_fd); in test_sockopt_sk()
|
D | cgroup_iter.c | 50 static void read_from_cgroup_iter(struct bpf_program *prog, int cgroup_fd, in read_from_cgroup_iter() argument 62 linfo.cgroup.cgroup_fd = cgroup_fd; in read_from_cgroup_iter() 102 linfo.cgroup.cgroup_fd = (__u32)-1; in test_invalid_cgroup() 119 linfo.cgroup.cgroup_fd = (__u32)cg_fd[PARENT]; in test_invalid_cgroup_spec()
|
D | sockopt_multi.c | 5 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title, const char *name) in prog_attach() argument 24 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach() 34 static int prog_detach(struct bpf_object *obj, int cgroup_fd, const char *title, const char *name) in prog_detach() argument 49 err = bpf_prog_detach2(bpf_program__fd(prog), cgroup_fd, in prog_detach()
|
D | fexit_bpf2bpf.c | 460 int cgroup_fd = -1; in test_fentry_to_cgroup_bpf() local 464 cgroup_fd = test__join_cgroup("/fentry_to_cgroup_bpf"); in test_fentry_to_cgroup_bpf() 465 if (!ASSERT_GE(cgroup_fd, 0, "cgroup_fd")) in test_fentry_to_cgroup_bpf() 472 skel->links.bind_v4_prog = bpf_program__attach_cgroup(skel->progs.bind_v4_prog, cgroup_fd); in test_fentry_to_cgroup_bpf() 496 if (cgroup_fd >= 0) in test_fentry_to_cgroup_bpf() 497 close(cgroup_fd); in test_fentry_to_cgroup_bpf()
|
D | sockopt.c | 876 static int run_test(int cgroup_fd, struct sockopt_test *test) in run_test() argument 891 err = bpf_prog_attach(prog_fd, cgroup_fd, test->attach_type, 0); in run_test() 964 bpf_prog_detach2(prog_fd, cgroup_fd, test->attach_type); in run_test() 972 int cgroup_fd, i; in test_sockopt() local 974 cgroup_fd = test__join_cgroup("/sockopt"); in test_sockopt() 975 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup")) in test_sockopt() 980 ASSERT_OK(run_test(cgroup_fd, &tests[i]), tests[i].descr); in test_sockopt() 983 close(cgroup_fd); in test_sockopt()
|
D | cgroup_hierarchical_stats.c | 247 int cgroup_fd, const char *file_name) in setup_cgroup_iter() argument 259 linfo.cgroup.cgroup_fd = cgroup_fd; in setup_cgroup_iter()
|
/linux-6.1.9/tools/bpf/bpftool/ |
D | cgroup.c | 169 static int count_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) in count_attached_bpf_progs() argument 174 ret = bpf_prog_query(cgroup_fd, type, query_flags, NULL, in count_attached_bpf_progs() 182 static int cgroup_has_attached_progs(int cgroup_fd) in cgroup_has_attached_progs() argument 188 int count = count_attached_bpf_progs(cgroup_fd, type); in cgroup_has_attached_progs() 202 static int show_effective_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_effective_bpf_progs() argument 214 ret = bpf_prog_query_opts(cgroup_fd, type, &p); in show_effective_bpf_progs() 227 static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_attached_bpf_progs() argument 243 ret = bpf_prog_query_opts(cgroup_fd, type, &p); in show_attached_bpf_progs() 277 static int show_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_bpf_progs() argument 281 show_effective_bpf_progs(cgroup_fd, type, level) : in show_bpf_progs() [all …]
|
/linux-6.1.9/tools/testing/selftests/bpf/ |
D | test_dev_cgroup.c | 27 int prog_fd, cgroup_fd; in main() local 39 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main() 40 if (cgroup_fd < 0) { in main() 46 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_DEVICE, 0)) { in main() 51 if (bpf_prog_query(cgroup_fd, BPF_CGROUP_DEVICE, 0, NULL, NULL, in main()
|
D | get_cgroup_id_user.c | 53 int cgroup_fd, cgidmap_fd, pidmap_fd; in main() local 65 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main() 66 if (CHECK(cgroup_fd < 0, "cgroup_setup_and_join", "err %d errno %d\n", cgroup_fd, errno)) in main()
|
D | test_cgroup_storage.c | 41 int map_fd, percpu_map_fd, prog_fd, cgroup_fd; in main() local 81 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main() 84 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, 0)) { in main()
|
/linux-6.1.9/tools/testing/selftests/cgroup/ |
D | cgroup_util.c | 346 pid_t clone_into_cgroup(int cgroup_fd) in clone_into_cgroup() argument 354 .cgroup = cgroup_fd, in clone_into_cgroup() 423 int cgroup_fd; in clone_into_cgroup_run_nowait() local 426 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_nowait() 427 if (cgroup_fd < 0) in clone_into_cgroup_run_nowait() 430 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_nowait() 431 close_prot_errno(cgroup_fd); in clone_into_cgroup_run_nowait() 582 int cgroup_fd; in clone_into_cgroup_run_wait() local 585 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_wait() 586 if (cgroup_fd < 0) in clone_into_cgroup_run_wait() [all …]
|
D | test_core.c | 146 int cgroup_fd = -EBADF; in test_cgcore_populated() local 200 cgroup_fd = dirfd_open_opath(cg_test_d); in test_cgcore_populated() 201 if (cgroup_fd < 0) in test_cgcore_populated() 204 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated() 236 pid = clone_into_cgroup(cgroup_fd); in test_cgcore_populated() 260 if (cgroup_fd >= 0) in test_cgcore_populated() 261 close(cgroup_fd); in test_cgcore_populated()
|