Home
last modified time | relevance | path

Searched refs:cgroup_fd (Results 1 - 25 of 56) sorted by relevance

123

/kernel/linux/linux-6.6/tools/testing/selftests/bpf/prog_tests/
H A 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()
69 int cgroup_fd = -1, cgroup_fd2 = -1, cgroup_fd3 = -1; in test_lsm_cgroup_functional() local
91 cgroup_fd = test__join_cgroup("/sock_policy"); in test_lsm_cgroup_functional()
92 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup")) in test_lsm_cgroup_functional()
106 ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_security"), 0, "prog count"); in test_lsm_cgroup_functional()
107 ASSERT_EQ(query_prog_cnt(cgroup_fd, NULL), 0, "total prog count"); in test_lsm_cgroup_functional()
108 err = bpf_prog_attach(alloc_prog_fd, cgroup_fd, BPF_LSM_CGROUP, 0); in test_lsm_cgroup_functional()
115 ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_securit in test_lsm_cgroup_functional()
[all...]
H A Dcgroup_getset_retval.c19 static void test_setsockopt_set(int cgroup_fd, int sock_fd) in test_setsockopt_set() argument
34 cgroup_fd); in test_setsockopt_set()
55 static void test_setsockopt_set_and_get(int cgroup_fd, int sock_fd) in test_setsockopt_set_and_get() argument
70 cgroup_fd); in test_setsockopt_set_and_get()
74 cgroup_fd); in test_setsockopt_set_and_get()
98 static void test_setsockopt_default_zero(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero() argument
113 cgroup_fd); in test_setsockopt_default_zero()
134 static void test_setsockopt_default_zero_and_set(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero_and_set() argument
150 cgroup_fd); in test_setsockopt_default_zero_and_set()
154 cgroup_fd); in test_setsockopt_default_zero_and_set()
178 test_setsockopt_override(int cgroup_fd, int sock_fd) test_setsockopt_override() argument
228 test_setsockopt_legacy_eperm(int cgroup_fd, int sock_fd) test_setsockopt_legacy_eperm() argument
273 test_setsockopt_legacy_no_override(int cgroup_fd, int sock_fd) test_setsockopt_legacy_no_override() argument
325 test_getsockopt_get(int cgroup_fd, int sock_fd) test_getsockopt_get() argument
367 test_getsockopt_override(int cgroup_fd, int sock_fd) test_getsockopt_override() argument
405 test_getsockopt_retval_sync(int cgroup_fd, int sock_fd) test_getsockopt_retval_sync() argument
473 test_exposed_hooks(int cgroup_fd, int sock_fd) test_exposed_hooks() argument
503 int cgroup_fd = -1; test_cgroup_getset_retval() local
[all...]
H A Dcgrp_local_storage.c22 static void test_tp_btf(int cgroup_fd) in test_tp_btf() argument
33 err = bpf_map_update_elem(bpf_map__fd(skel->maps.map_b), &cgroup_fd, &val1, BPF_ANY); in test_tp_btf()
38 err = bpf_map_lookup_elem(bpf_map__fd(skel->maps.map_b), &cgroup_fd, &val2); in test_tp_btf()
45 err = bpf_map_delete_elem(bpf_map__fd(skel->maps.map_b), &cgroup_fd); in test_tp_btf()
68 static void test_attach_cgroup(int cgroup_fd) in test_attach_cgroup() argument
82 skel->progs.set_cookie, cgroup_fd); in test_attach_cgroup()
87 skel->progs.update_cookie_sockops, cgroup_fd); in test_attach_cgroup()
105 &cgroup_fd, &val); in test_attach_cgroup()
124 static void test_recursion(int cgroup_fd) in test_recursion() argument
155 static void test_cgroup_iter_sleepable(int cgroup_fd, __u6 argument
242 int cgroup_fd; test_cgrp_local_storage() local
[all...]
H A 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()
[all...]
H A 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_f in test_connect_force_port()
[all...]
H A 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, ske in test_connect_ping()
[all...]
H A Dmptcp.c156 static int run_test(int cgroup_fd, int server_fd, bool is_mptcp) in run_test() argument
171 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test()
194 int server_fd, cgroup_fd; in test_base() local
196 cgroup_fd = test__join_cgroup("/mptcp"); in test_base()
197 if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup")) in test_base()
209 ASSERT_OK(run_test(cgroup_fd, server_fd, false), "run_test tcp"); in test_base()
219 ASSERT_OK(run_test(cgroup_fd, server_fd, true), "run_test mptcp"); in test_base()
225 close(cgroup_fd); in test_base()
267 static int run_mptcpify(int cgroup_fd) in run_mptcpify() argument
308 int cgroup_fd; in test_mptcpify() local
[all...]
H A 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()
H A 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()
H A 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()
H A 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()
H A 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()
H A Dsockopt_inherit.c137 static void run_test(int cgroup_fd) in run_test() argument
154 cgroup_fd); in run_test()
159 cgroup_fd); in run_test()
202 int cgroup_fd; in test_sockopt_inherit() local
204 cgroup_fd = test__join_cgroup("/sockopt_inherit"); in test_sockopt_inherit()
205 if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup")) in test_sockopt_inherit()
208 run_test(cgroup_fd); in test_sockopt_inherit()
209 close(cgroup_fd); in test_sockopt_inherit()
H A 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()
H A Dcgroup_tcp_skb.c16 static int install_filters(int cgroup_fd, in install_filters() argument
28 cgroup_fd); in install_filters()
33 cgroup_fd); in install_filters()
242 int cgroup_fd = -1; in test_cgroup_tcp_skb() local
253 cgroup_fd = create_and_get_cgroup(CGROUP_TCP_SKB_PATH); in test_cgroup_tcp_skb()
254 if (!ASSERT_GE(cgroup_fd, 0, "cgroup_fd")) in test_cgroup_tcp_skb()
258 err = install_filters(cgroup_fd, &egress_link, &ingress_link, in test_cgroup_tcp_skb()
279 err = install_filters(cgroup_fd, &egress_link, &ingress_link, in test_cgroup_tcp_skb()
298 err = install_filters(cgroup_fd, in test_cgroup_tcp_skb()
[all...]
/kernel/linux/linux-5.10/tools/bpf/bpftool/
H A Dcgroup.c91 static int count_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) in count_attached_bpf_progs() argument
96 ret = bpf_prog_query(cgroup_fd, type, query_flags, NULL, in count_attached_bpf_progs()
104 static int cgroup_has_attached_progs(int cgroup_fd) in cgroup_has_attached_progs() argument
110 int count = count_attached_bpf_progs(cgroup_fd, type); in cgroup_has_attached_progs()
123 static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, in show_attached_bpf_progs() argument
134 ret = bpf_prog_query(cgroup_fd, type, query_flags, &attach_flags, in show_attached_bpf_progs()
169 int cgroup_fd; in do_show() local
193 cgroup_fd = open(path, O_RDONLY); in do_show()
194 if (cgroup_fd < 0) { in do_show()
199 has_attached_progs = cgroup_has_attached_progs(cgroup_fd); in do_show()
247 int cgroup_fd; do_show_tree_fn() local
383 int cgroup_fd, prog_fd; do_attach() local
443 int prog_fd, cgroup_fd; do_detach() local
[all...]
/kernel/linux/linux-6.6/tools/bpf/bpftool/
H A 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, typ in show_bpf_progs()
290 int cgroup_fd; do_show() local
371 int cgroup_fd; do_show_tree_fn() local
513 int cgroup_fd, prog_fd; do_attach() local
573 int prog_fd, cgroup_fd; do_detach() local
[all...]
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/prog_tests/
H A Dconnect_force_port.c49 static int run_test(int cgroup_fd, int server_fd, int family, int type) in run_test() argument
77 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
93 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
109 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, v4 ? in run_test()
134 int server_fd, cgroup_fd; in test_connect_force_port() local
136 cgroup_fd = test__join_cgroup("/connect_force_port"); in test_connect_force_port()
137 if (CHECK_FAIL(cgroup_fd < 0)) in test_connect_force_port()
143 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET, SOCK_STREAM)); in test_connect_force_port()
149 CHECK_FAIL(run_test(cgroup_fd, server_fd, AF_INET6, SOCK_STREAM)); in test_connect_force_port()
155 CHECK_FAIL(run_test(cgroup_fd, server_f in test_connect_force_port()
[all...]
H A Dsockopt_inherit.c139 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title) in prog_attach() argument
158 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
168 static void run_test(int cgroup_fd) in run_test() argument
184 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt"); in run_test()
188 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt"); in run_test()
228 int cgroup_fd; in test_sockopt_inherit() local
230 cgroup_fd = test__join_cgroup("/sockopt_inherit"); in test_sockopt_inherit()
231 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_inherit()
234 run_test(cgroup_fd); in test_sockopt_inherit()
235 close(cgroup_fd); in test_sockopt_inherit()
[all...]
H A Dudp_limit.c14 int cgroup_fd; in test_udp_limit() local
16 cgroup_fd = test__join_cgroup("/udp_limit"); in test_udp_limit()
17 if (CHECK(cgroup_fd < 0, "cg-join", "errno %d", errno)) in test_udp_limit()
24 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()
74 close(cgroup_fd); in test_udp_limit()
H A Dsockopt_sk.c194 static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title) in prog_attach() argument
213 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach()
223 static void run_test(int cgroup_fd) in run_test() argument
236 err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt"); in run_test()
240 err = prog_attach(obj, cgroup_fd, "cgroup/setsockopt"); in run_test()
252 int cgroup_fd; in test_sockopt_sk() local
254 cgroup_fd = test__join_cgroup("/sockopt_sk"); in test_sockopt_sk()
255 if (CHECK_FAIL(cgroup_fd < 0)) in test_sockopt_sk()
258 run_test(cgroup_fd); in test_sockopt_sk()
259 close(cgroup_fd); in test_sockopt_sk()
[all...]
H A Dtcp_rtt.c92 static int run_test(int cgroup_fd, int server_fd) in run_test() argument
115 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0); in run_test()
158 int server_fd, cgroup_fd; in test_tcp_rtt() local
160 cgroup_fd = test__join_cgroup("/tcp_rtt"); in test_tcp_rtt()
161 if (CHECK_FAIL(cgroup_fd < 0)) in test_tcp_rtt()
168 CHECK_FAIL(run_test(cgroup_fd, server_fd)); in test_tcp_rtt()
173 close(cgroup_fd); in test_tcp_rtt()
H A 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()
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/
H A Dtest_dev_cgroup.c27 int prog_fd, cgroup_fd; in main() local
36 cgroup_fd = cgroup_setup_and_join(TEST_CGROUP); in main()
37 if (cgroup_fd < 0) { in main()
43 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_DEVICE, 0)) { in main()
48 if (bpf_prog_query(cgroup_fd, BPF_CGROUP_DEVICE, 0, NULL, NULL, in main()
/kernel/linux/linux-6.6/tools/testing/selftests/bpf/
H A 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()

Completed in 8 milliseconds

123