Home
last modified time | relevance | path

Searched refs:cgroup_fd (Results 1 – 25 of 33) sorted by relevance

12

/linux-6.1.9/tools/testing/selftests/bpf/prog_tests/
Dcgroup_getset_retval.c19 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 …]
Dlsm_cgroup.c19 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 …]
Dcgroup_v1v2.c10 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()
Dconnect_force_port.c49 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 …]
Dconnect_ping.c20 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 …]
Dudp_limit.c12 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()
Dsockopt_inherit.c135 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()
Dmptcp.c94 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()
Dsocket_cookie.c18 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()
Dtcp_rtt.c90 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()
Dbind_perm.c57 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()
Dnetns_cookie.c15 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()
Dload_bytes_relative.c12 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()
Dsockopt_sk.c195 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()
Dcgroup_iter.c50 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()
Dsockopt_multi.c5 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()
Dfexit_bpf2bpf.c460 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()
Dsockopt.c876 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()
Dcgroup_hierarchical_stats.c247 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/
Dcgroup.c169 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/
Dtest_dev_cgroup.c27 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()
Dget_cgroup_id_user.c53 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()
Dtest_cgroup_storage.c41 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/
Dcgroup_util.c346 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 …]
Dtest_core.c146 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()

12