Lines Matching +full:multi +full:- +full:socket

1 // SPDX-License-Identifier: GPL-2.0-only
16 #include <linux/bpf-cgroup.h>
20 #include "../cgroup/cgroup-internal.h"
28 percpu_ref_kill(&cgrp->bpf.refcnt); in cgroup_bpf_offline()
53 map = prog->aux->cgroup_storage[stype]; in bpf_cgroup_storages_alloc()
64 return -ENOMEM; in bpf_cgroup_storages_alloc()
92 /* Called when bpf_cgroup_link is auto-detached from dying cgroup.
99 cgroup_put(link->cgroup); in bpf_cgroup_link_auto_detach()
100 link->cgroup = NULL; in bpf_cgroup_link_auto_detach()
104 * cgroup_bpf_release() - put references of all bpf programs and
113 struct list_head *storages = &cgrp->bpf.storages; in cgroup_bpf_release()
120 for (type = 0; type < ARRAY_SIZE(cgrp->bpf.progs); type++) { in cgroup_bpf_release()
121 struct list_head *progs = &cgrp->bpf.progs[type]; in cgroup_bpf_release()
125 list_del(&pl->node); in cgroup_bpf_release()
126 if (pl->prog) in cgroup_bpf_release()
127 bpf_prog_put(pl->prog); in cgroup_bpf_release()
128 if (pl->link) in cgroup_bpf_release()
129 bpf_cgroup_link_auto_detach(pl->link); in cgroup_bpf_release()
134 cgrp->bpf.effective[type], in cgroup_bpf_release()
149 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_release()
154 * cgroup_bpf_release_fn() - callback used to schedule releasing
162 INIT_WORK(&cgrp->bpf.release_work, cgroup_bpf_release); in cgroup_bpf_release_fn()
163 queue_work(system_wq, &cgrp->bpf.release_work); in cgroup_bpf_release_fn()
171 if (pl->prog) in prog_list_prog()
172 return pl->prog; in prog_list_prog()
173 if (pl->link) in prog_list_prog()
174 return pl->link->link.prog; in prog_list_prog()
194 /* if parent has non-overridable prog attached,
196 * if parent has overridable or multi-prog, allow attaching
207 u32 flags = p->bpf.flags[type]; in hierarchy_allows_attach()
212 cnt = prog_list_length(&p->bpf.progs[type]); in hierarchy_allows_attach()
224 * Note that parent's F_ALLOW_OVERRIDE-type program is yielding
239 if (cnt == 0 || (p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
240 cnt += prog_list_length(&p->bpf.progs[type]); in compute_effective_progs()
246 return -ENOMEM; in compute_effective_progs()
252 if (cnt > 0 && !(p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
255 list_for_each_entry(pl, &p->bpf.progs[type], node) { in compute_effective_progs()
259 item = &progs->items[cnt]; in compute_effective_progs()
260 item->prog = prog_list_prog(pl); in compute_effective_progs()
261 bpf_cgroup_storages_assign(item->cgroup_storage, in compute_effective_progs()
262 pl->storage); in compute_effective_progs()
275 old_array = rcu_replace_pointer(cgrp->bpf.effective[type], old_array, in activate_effective_progs()
284 * cgroup_bpf_inherit() - inherit effective programs from parent
292 #define NR ARRAY_SIZE(cgrp->bpf.effective) in cgroup_bpf_inherit()
297 ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0, in cgroup_bpf_inherit()
306 INIT_LIST_HEAD(&cgrp->bpf.progs[i]); in cgroup_bpf_inherit()
308 INIT_LIST_HEAD(&cgrp->bpf.storages); in cgroup_bpf_inherit()
325 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_inherit()
327 return -ENOMEM; in cgroup_bpf_inherit()
337 css_for_each_descendant_pre(css, &cgrp->self) { in update_effective_progs()
340 if (percpu_ref_is_zero(&desc->bpf.refcnt)) in update_effective_progs()
343 err = compute_effective_progs(desc, type, &desc->bpf.inactive); in update_effective_progs()
349 css_for_each_descendant_pre(css, &cgrp->self) { in update_effective_progs()
352 if (percpu_ref_is_zero(&desc->bpf.refcnt)) { in update_effective_progs()
353 if (unlikely(desc->bpf.inactive)) { in update_effective_progs()
354 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
355 desc->bpf.inactive = NULL; in update_effective_progs()
360 activate_effective_progs(desc, type, desc->bpf.inactive); in update_effective_progs()
361 desc->bpf.inactive = NULL; in update_effective_progs()
370 css_for_each_descendant_pre(css, &cgrp->self) { in update_effective_progs()
373 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
374 desc->bpf.inactive = NULL; in update_effective_progs()
390 /* single-attach case */ in find_attach_entry()
398 if (prog && pl->prog == prog && prog != replace_prog) in find_attach_entry()
400 return ERR_PTR(-EINVAL); in find_attach_entry()
401 if (link && pl->link == link) in find_attach_entry()
403 return ERR_PTR(-EINVAL); in find_attach_entry()
406 /* direct prog multi-attach w/ replacement case */ in find_attach_entry()
409 if (pl->prog == replace_prog) in find_attach_entry()
414 return ERR_PTR(-ENOENT); in find_attach_entry()
421 * __cgroup_bpf_attach() - Attach the program or the link to a cgroup, and
430 * Exactly one of @prog or @link can be non-null.
439 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_attach()
449 return -EINVAL; in __cgroup_bpf_attach()
452 return -EINVAL; in __cgroup_bpf_attach()
455 return -EINVAL; in __cgroup_bpf_attach()
458 return -EPERM; in __cgroup_bpf_attach()
460 if (!list_empty(progs) && cgrp->bpf.flags[type] != saved_flags) in __cgroup_bpf_attach()
461 /* Disallow attaching non-overridable on top in __cgroup_bpf_attach()
463 * Disallow attaching multi-prog if overridable or none in __cgroup_bpf_attach()
465 return -EPERM; in __cgroup_bpf_attach()
468 return -E2BIG; in __cgroup_bpf_attach()
476 prog ? : link->link.prog, cgrp)) in __cgroup_bpf_attach()
477 return -ENOMEM; in __cgroup_bpf_attach()
480 old_prog = pl->prog; in __cgroup_bpf_attach()
485 return -ENOMEM; in __cgroup_bpf_attach()
487 list_add_tail(&pl->node, progs); in __cgroup_bpf_attach()
490 pl->prog = prog; in __cgroup_bpf_attach()
491 pl->link = link; in __cgroup_bpf_attach()
492 bpf_cgroup_storages_assign(pl->storage, storage); in __cgroup_bpf_attach()
493 cgrp->bpf.flags[type] = saved_flags; in __cgroup_bpf_attach()
508 pl->prog = old_prog; in __cgroup_bpf_attach()
509 pl->link = NULL; in __cgroup_bpf_attach()
513 list_del(&pl->node); in __cgroup_bpf_attach()
534 css_for_each_descendant_pre(css, &cgrp->self) { in replace_effective_prog()
537 if (percpu_ref_is_zero(&desc->bpf.refcnt)) in replace_effective_prog()
542 if (pos && !(cg->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in replace_effective_prog()
545 head = &cg->bpf.progs[type]; in replace_effective_prog()
549 if (pl->link == link) in replace_effective_prog()
557 desc->bpf.effective[type], in replace_effective_prog()
559 item = &progs->items[pos]; in replace_effective_prog()
560 WRITE_ONCE(item->prog, link->link.prog); in replace_effective_prog()
565 * __cgroup_bpf_replace() - Replace link's program and propagate the change
577 struct list_head *progs = &cgrp->bpf.progs[link->type]; in __cgroup_bpf_replace()
582 if (link->link.prog->type != new_prog->type) in __cgroup_bpf_replace()
583 return -EINVAL; in __cgroup_bpf_replace()
586 if (pl->link == link) { in __cgroup_bpf_replace()
592 return -ENOENT; in __cgroup_bpf_replace()
594 old_prog = xchg(&link->link.prog, new_prog); in __cgroup_bpf_replace()
595 replace_effective_prog(cgrp, link->type, link); in __cgroup_bpf_replace()
609 /* link might have been auto-released by dying cgroup, so fail */ in cgroup_bpf_replace()
610 if (!cg_link->cgroup) { in cgroup_bpf_replace()
611 ret = -ENOLINK; in cgroup_bpf_replace()
614 if (old_prog && link->prog != old_prog) { in cgroup_bpf_replace()
615 ret = -EPERM; in cgroup_bpf_replace()
618 ret = __cgroup_bpf_replace(cg_link->cgroup, cg_link, new_prog); in cgroup_bpf_replace()
634 return ERR_PTR(-ENOENT); in find_detach_entry()
643 /* to detach MULTI prog the user has to specify valid FD in find_detach_entry()
646 return ERR_PTR(-EINVAL); in find_detach_entry()
650 if (pl->prog == prog && pl->link == link) in find_detach_entry()
653 return ERR_PTR(-ENOENT); in find_detach_entry()
657 * __cgroup_bpf_detach() - Detach the program or link from a cgroup, and
664 * At most one of @prog or @link can be non-NULL.
670 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_detach()
671 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_detach()
678 return -EINVAL; in __cgroup_bpf_detach()
685 old_prog = pl->prog; in __cgroup_bpf_detach()
686 pl->prog = NULL; in __cgroup_bpf_detach()
687 pl->link = NULL; in __cgroup_bpf_detach()
694 list_del(&pl->node); in __cgroup_bpf_detach()
698 cgrp->bpf.flags[type] = 0; in __cgroup_bpf_detach()
706 pl->prog = old_prog; in __cgroup_bpf_detach()
707 pl->link = link; in __cgroup_bpf_detach()
715 __u32 __user *prog_ids = u64_to_user_ptr(attr->query.prog_ids); in __cgroup_bpf_query()
716 enum bpf_attach_type type = attr->query.attach_type; in __cgroup_bpf_query()
717 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_query()
718 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_query()
723 effective = rcu_dereference_protected(cgrp->bpf.effective[type], in __cgroup_bpf_query()
726 if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE) in __cgroup_bpf_query()
731 if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags))) in __cgroup_bpf_query()
732 return -EFAULT; in __cgroup_bpf_query()
733 if (copy_to_user(&uattr->query.prog_cnt, &cnt, sizeof(cnt))) in __cgroup_bpf_query()
734 return -EFAULT; in __cgroup_bpf_query()
735 if (attr->query.prog_cnt == 0 || !prog_ids || !cnt) in __cgroup_bpf_query()
738 if (attr->query.prog_cnt < cnt) { in __cgroup_bpf_query()
739 cnt = attr->query.prog_cnt; in __cgroup_bpf_query()
740 ret = -ENOSPC; in __cgroup_bpf_query()
743 if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE) { in __cgroup_bpf_query()
752 id = prog->aux->id; in __cgroup_bpf_query()
754 return -EFAULT; in __cgroup_bpf_query()
769 cgrp = cgroup_get_from_fd(attr->target_fd); in cgroup_bpf_prog_attach()
773 if ((attr->attach_flags & BPF_F_ALLOW_MULTI) && in cgroup_bpf_prog_attach()
774 (attr->attach_flags & BPF_F_REPLACE)) { in cgroup_bpf_prog_attach()
775 replace_prog = bpf_prog_get_type(attr->replace_bpf_fd, ptype); in cgroup_bpf_prog_attach()
783 attr->attach_type, attr->attach_flags); in cgroup_bpf_prog_attach()
797 cgrp = cgroup_get_from_fd(attr->target_fd); in cgroup_bpf_prog_detach()
801 prog = bpf_prog_get_type(attr->attach_bpf_fd, ptype); in cgroup_bpf_prog_detach()
805 ret = cgroup_bpf_detach(cgrp, prog, attr->attach_type); in cgroup_bpf_prog_detach()
819 /* link might have been auto-detached by dying cgroup already, in bpf_cgroup_link_release()
822 if (!cg_link->cgroup) in bpf_cgroup_link_release()
827 /* re-check cgroup under lock again */ in bpf_cgroup_link_release()
828 if (!cg_link->cgroup) { in bpf_cgroup_link_release()
833 WARN_ON(__cgroup_bpf_detach(cg_link->cgroup, NULL, cg_link, in bpf_cgroup_link_release()
834 cg_link->type)); in bpf_cgroup_link_release()
836 cg = cg_link->cgroup; in bpf_cgroup_link_release()
837 cg_link->cgroup = NULL; in bpf_cgroup_link_release()
867 if (cg_link->cgroup) in bpf_cgroup_link_show_fdinfo()
868 cg_id = cgroup_id(cg_link->cgroup); in bpf_cgroup_link_show_fdinfo()
875 cg_link->type); in bpf_cgroup_link_show_fdinfo()
886 if (cg_link->cgroup) in bpf_cgroup_link_fill_link_info()
887 cg_id = cgroup_id(cg_link->cgroup); in bpf_cgroup_link_fill_link_info()
890 info->cgroup.cgroup_id = cg_id; in bpf_cgroup_link_fill_link_info()
891 info->cgroup.attach_type = cg_link->type; in bpf_cgroup_link_fill_link_info()
911 if (attr->link_create.flags) in cgroup_bpf_link_attach()
912 return -EINVAL; in cgroup_bpf_link_attach()
914 cgrp = cgroup_get_from_fd(attr->link_create.target_fd); in cgroup_bpf_link_attach()
920 err = -ENOMEM; in cgroup_bpf_link_attach()
923 bpf_link_init(&link->link, BPF_LINK_TYPE_CGROUP, &bpf_cgroup_link_lops, in cgroup_bpf_link_attach()
925 link->cgroup = cgrp; in cgroup_bpf_link_attach()
926 link->type = attr->link_create.attach_type; in cgroup_bpf_link_attach()
928 err = bpf_link_prime(&link->link, &link_primer); in cgroup_bpf_link_attach()
934 err = cgroup_bpf_attach(cgrp, NULL, NULL, link, link->type, in cgroup_bpf_link_attach()
954 cgrp = cgroup_get_from_fd(attr->query.target_fd); in cgroup_bpf_prog_query()
965 * __cgroup_bpf_run_filter_skb() - Run a program for packet filtering
966 * @sk: The socket sending or receiving traffic
970 * If no socket is passed, or the socket is not of type INET or INET6,
977 * NET_XMIT_SUCCESS (0) - continue with packet output
978 * NET_XMIT_DROP (1) - drop packet and notify TCP to call cwr
979 * NET_XMIT_CN (2) - continue with packet output and notify TCP
981 * -EPERM - drop packet
983 * For ingress packets, this function will return -EPERM if any
991 unsigned int offset = skb->data - skb_network_header(skb); in __cgroup_bpf_run_filter_skb()
1000 if (sk->sk_family != AF_INET && sk->sk_family != AF_INET6) in __cgroup_bpf_run_filter_skb()
1003 cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_skb()
1004 save_sk = skb->sk; in __cgroup_bpf_run_filter_skb()
1005 skb->sk = sk; in __cgroup_bpf_run_filter_skb()
1013 cgrp->bpf.effective[type], skb, __bpf_prog_run_save_cb); in __cgroup_bpf_run_filter_skb()
1015 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], skb, in __cgroup_bpf_run_filter_skb()
1017 ret = (ret == 1 ? 0 : -EPERM); in __cgroup_bpf_run_filter_skb()
1021 skb->sk = save_sk; in __cgroup_bpf_run_filter_skb()
1028 * __cgroup_bpf_run_filter_sk() - Run a program on a sock
1032 * socket is passed is expected to be of type INET or INET6.
1037 * This function will return %-EPERM if any if an attached program was found
1043 struct cgroup *cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_sk()
1046 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sk, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sk()
1047 return ret == 1 ? 0 : -EPERM; in __cgroup_bpf_run_filter_sk()
1052 * __cgroup_bpf_run_filter_sock_addr() - Run a program on a sock and
1059 * socket is expected to be of type INET or INET6.
1061 * This function will return %-EPERM if an attached program is found and
1078 /* Check socket family since not all sockets represent network in __cgroup_bpf_run_filter_sock_addr()
1081 if (sk->sk_family != AF_INET && sk->sk_family != AF_INET6) in __cgroup_bpf_run_filter_sock_addr()
1089 cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_sock_addr()
1090 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sock_addr()
1092 return ret == 1 ? 0 : -EPERM; in __cgroup_bpf_run_filter_sock_addr()
1097 * __cgroup_bpf_run_filter_sock_ops() - Run a program on a sock
1098 * @sk: socket to get cgroup from
1104 * socket passed is expected to be of type INET or INET6.
1109 * This function will return %-EPERM if any if an attached program was found
1116 struct cgroup *cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_sock_ops()
1119 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sock_ops, in __cgroup_bpf_run_filter_sock_ops()
1121 return ret == 1 ? 0 : -EPERM; in __cgroup_bpf_run_filter_sock_ops()
1138 allow = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, in __cgroup_bpf_check_dev_permission()
1207 * __cgroup_bpf_run_filter_sysctl - Run a program on sysctl
1213 * @pcount: value-result argument: value is size of buffer pointed to by @buf,
1216 * @ppos: value-result argument: value is position at which read from or write
1224 * This function will return %-EPERM if an attached program is found and
1249 table->proc_handler(table, 0, ctx.cur_val, &ctx.cur_len, &pos)) { in __cgroup_bpf_run_filter_sysctl()
1270 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sysctl()
1283 return ret == 1 ? 0 : -EPERM; in __cgroup_bpf_run_filter_sysctl()
1294 prog_array = rcu_dereference(cgrp->bpf.effective[attach_type]); in __cgroup_bpf_prog_array_is_empty()
1304 return -EINVAL; in sockopt_alloc_buf()
1313 ctx->optval = kzalloc(max_optlen, GFP_USER); in sockopt_alloc_buf()
1314 if (!ctx->optval) in sockopt_alloc_buf()
1315 return -ENOMEM; in sockopt_alloc_buf()
1317 ctx->optval_end = ctx->optval + max_optlen; in sockopt_alloc_buf()
1324 kfree(ctx->optval); in sockopt_free_buf()
1331 struct cgroup *cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_setsockopt()
1341 * memory and locking the socket. in __cgroup_bpf_run_filter_setsockopt()
1360 ret = -EFAULT; in __cgroup_bpf_run_filter_setsockopt()
1365 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_SETSOCKOPT], in __cgroup_bpf_run_filter_setsockopt()
1370 ret = -EPERM; in __cgroup_bpf_run_filter_setsockopt()
1374 if (ctx.optlen == -1) { in __cgroup_bpf_run_filter_setsockopt()
1375 /* optlen set to -1, bypass kernel */ in __cgroup_bpf_run_filter_setsockopt()
1377 } else if (ctx.optlen > max_optlen || ctx.optlen < -1) { in __cgroup_bpf_run_filter_setsockopt()
1379 ret = -EFAULT; in __cgroup_bpf_run_filter_setsockopt()
1408 struct cgroup *cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); in __cgroup_bpf_run_filter_getsockopt()
1419 * memory and locking the socket. in __cgroup_bpf_run_filter_getsockopt()
1440 ret = -EFAULT; in __cgroup_bpf_run_filter_getsockopt()
1446 ret = -EFAULT; in __cgroup_bpf_run_filter_getsockopt()
1452 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_GETSOCKOPT], in __cgroup_bpf_run_filter_getsockopt()
1457 ret = -EPERM; in __cgroup_bpf_run_filter_getsockopt()
1462 ret = -EFAULT; in __cgroup_bpf_run_filter_getsockopt()
1470 ret = -EFAULT; in __cgroup_bpf_run_filter_getsockopt()
1477 ret = -EFAULT; in __cgroup_bpf_run_filter_getsockopt()
1495 if (dir->header.parent) { in sysctl_cpy_dir()
1496 tmp_ret = sysctl_cpy_dir(dir->header.parent, bufp, lenp); in sysctl_cpy_dir()
1501 ret = strscpy(*bufp, dir->header.ctl_table[0].procname, *lenp); in sysctl_cpy_dir()
1505 *lenp -= ret; in sysctl_cpy_dir()
1516 *lenp -= tmp_ret; in sysctl_cpy_dir()
1527 return -EINVAL; in BPF_CALL_4()
1530 if (!ctx->head) in BPF_CALL_4()
1531 return -EINVAL; in BPF_CALL_4()
1532 tmp_ret = sysctl_cpy_dir(ctx->head->parent, &buf, &buf_len); in BPF_CALL_4()
1537 ret = strscpy(buf, ctx->table->procname, buf_len); in BPF_CALL_4()
1556 return -EINVAL; in copy_sysctl_value()
1559 return -E2BIG; in copy_sysctl_value()
1563 return -EINVAL; in copy_sysctl_value()
1569 memset(dst + src_len, '\0', dst_len - src_len); in copy_sysctl_value()
1573 dst[dst_len - 1] = '\0'; in copy_sysctl_value()
1575 return -E2BIG; in copy_sysctl_value()
1581 return copy_sysctl_value(buf, buf_len, ctx->cur_val, ctx->cur_len); in BPF_CALL_3()
1596 if (!ctx->write) { in BPF_CALL_3()
1599 return -EINVAL; in BPF_CALL_3()
1601 return copy_sysctl_value(buf, buf_len, ctx->new_val, ctx->new_len); in BPF_CALL_3()
1616 if (!ctx->write || !ctx->new_val || !ctx->new_len || !buf || !buf_len) in BPF_CALL_3()
1617 return -EINVAL; in BPF_CALL_3()
1619 if (buf_len > PAGE_SIZE - 1) in BPF_CALL_3()
1620 return -E2BIG; in BPF_CALL_3()
1622 memcpy(ctx->new_val, buf, buf_len); in BPF_CALL_3()
1623 ctx->new_len = buf_len; in BPF_CALL_3()
1624 ctx->new_updated = 1; in BPF_CALL_3()
1694 switch (si->off) { in sysctl_convert_ctx_access()
1697 BPF_SIZE(si->code), si->dst_reg, si->src_reg, in sysctl_convert_ctx_access()
1712 if (si->src_reg == treg || si->dst_reg == treg) in sysctl_convert_ctx_access()
1713 --treg; in sysctl_convert_ctx_access()
1714 if (si->src_reg == treg || si->dst_reg == treg) in sysctl_convert_ctx_access()
1715 --treg; in sysctl_convert_ctx_access()
1717 BPF_DW, si->dst_reg, treg, in sysctl_convert_ctx_access()
1721 treg, si->dst_reg, in sysctl_convert_ctx_access()
1724 BPF_SIZEOF(u32), treg, si->src_reg, in sysctl_convert_ctx_access()
1728 BPF_DW, treg, si->dst_reg, in sysctl_convert_ctx_access()
1733 si->dst_reg, si->src_reg, in sysctl_convert_ctx_access()
1735 read_size = bpf_size_to_bytes(BPF_SIZE(si->code)); in sysctl_convert_ctx_access()
1737 BPF_SIZE(si->code), si->dst_reg, si->dst_reg, in sysctl_convert_ctx_access()
1745 return insn - insn_buf; in sysctl_convert_ctx_access()
1794 return prog->expected_attach_type == in cg_sockopt_is_valid_access()
1801 return prog->expected_attach_type == in cg_sockopt_is_valid_access()
1814 info->reg_type = PTR_TO_SOCKET; in cg_sockopt_is_valid_access()
1819 info->reg_type = PTR_TO_PACKET; in cg_sockopt_is_valid_access()
1824 info->reg_type = PTR_TO_PACKET_END; in cg_sockopt_is_valid_access()
1829 return prog->expected_attach_type == BPF_CGROUP_GETSOCKOPT; in cg_sockopt_is_valid_access()
1840 si->dst_reg, si->src_reg, \
1851 switch (si->off) { in cg_sockopt_convert_ctx_access()
1887 return insn - insn_buf; in cg_sockopt_convert_ctx_access()