Lines Matching refs:func_id
240 int func_id; member
453 static bool is_release_function(enum bpf_func_id func_id) in is_release_function() argument
455 return func_id == BPF_FUNC_sk_release || in is_release_function()
456 func_id == BPF_FUNC_ringbuf_submit || in is_release_function()
457 func_id == BPF_FUNC_ringbuf_discard; in is_release_function()
460 static bool may_be_acquire_function(enum bpf_func_id func_id) in may_be_acquire_function() argument
462 return func_id == BPF_FUNC_sk_lookup_tcp || in may_be_acquire_function()
463 func_id == BPF_FUNC_sk_lookup_udp || in may_be_acquire_function()
464 func_id == BPF_FUNC_skc_lookup_tcp || in may_be_acquire_function()
465 func_id == BPF_FUNC_map_lookup_elem || in may_be_acquire_function()
466 func_id == BPF_FUNC_ringbuf_reserve; in may_be_acquire_function()
469 static bool is_acquire_function(enum bpf_func_id func_id, in is_acquire_function() argument
474 if (func_id == BPF_FUNC_sk_lookup_tcp || in is_acquire_function()
475 func_id == BPF_FUNC_sk_lookup_udp || in is_acquire_function()
476 func_id == BPF_FUNC_skc_lookup_tcp || in is_acquire_function()
477 func_id == BPF_FUNC_ringbuf_reserve) in is_acquire_function()
480 if (func_id == BPF_FUNC_map_lookup_elem && in is_acquire_function()
488 static bool is_ptr_cast_function(enum bpf_func_id func_id) in is_ptr_cast_function() argument
490 return func_id == BPF_FUNC_tcp_sock || in is_ptr_cast_function()
491 func_id == BPF_FUNC_sk_fullsock || in is_ptr_cast_function()
492 func_id == BPF_FUNC_skc_to_tcp_sock || in is_ptr_cast_function()
493 func_id == BPF_FUNC_skc_to_tcp6_sock || in is_ptr_cast_function()
494 func_id == BPF_FUNC_skc_to_udp6_sock || in is_ptr_cast_function()
495 func_id == BPF_FUNC_skc_to_tcp_timewait_sock || in is_ptr_cast_function()
496 func_id == BPF_FUNC_skc_to_tcp_request_sock; in is_ptr_cast_function()
4801 if (meta->func_id == BPF_FUNC_spin_lock) { in check_func_arg()
4804 } else if (meta->func_id == BPF_FUNC_spin_unlock) { in check_func_arg()
4883 static bool may_update_sockmap(struct bpf_verifier_env *env, int func_id) in may_update_sockmap() argument
4888 if (func_id != BPF_FUNC_map_update_elem) in may_update_sockmap()
4921 struct bpf_map *map, int func_id) in check_map_func_compatibility() argument
4929 if (func_id != BPF_FUNC_tail_call) in check_map_func_compatibility()
4933 if (func_id != BPF_FUNC_perf_event_read && in check_map_func_compatibility()
4934 func_id != BPF_FUNC_perf_event_output && in check_map_func_compatibility()
4935 func_id != BPF_FUNC_skb_output && in check_map_func_compatibility()
4936 func_id != BPF_FUNC_perf_event_read_value && in check_map_func_compatibility()
4937 func_id != BPF_FUNC_xdp_output) in check_map_func_compatibility()
4941 if (func_id != BPF_FUNC_ringbuf_output && in check_map_func_compatibility()
4942 func_id != BPF_FUNC_ringbuf_reserve && in check_map_func_compatibility()
4943 func_id != BPF_FUNC_ringbuf_query) in check_map_func_compatibility()
4947 if (func_id != BPF_FUNC_get_stackid) in check_map_func_compatibility()
4951 if (func_id != BPF_FUNC_skb_under_cgroup && in check_map_func_compatibility()
4952 func_id != BPF_FUNC_current_task_under_cgroup) in check_map_func_compatibility()
4957 if (func_id != BPF_FUNC_get_local_storage) in check_map_func_compatibility()
4962 if (func_id != BPF_FUNC_redirect_map && in check_map_func_compatibility()
4963 func_id != BPF_FUNC_map_lookup_elem) in check_map_func_compatibility()
4970 if (func_id != BPF_FUNC_redirect_map) in check_map_func_compatibility()
4974 if (func_id != BPF_FUNC_redirect_map && in check_map_func_compatibility()
4975 func_id != BPF_FUNC_map_lookup_elem) in check_map_func_compatibility()
4980 if (func_id != BPF_FUNC_map_lookup_elem) in check_map_func_compatibility()
4984 if (func_id != BPF_FUNC_sk_redirect_map && in check_map_func_compatibility()
4985 func_id != BPF_FUNC_sock_map_update && in check_map_func_compatibility()
4986 func_id != BPF_FUNC_map_delete_elem && in check_map_func_compatibility()
4987 func_id != BPF_FUNC_msg_redirect_map && in check_map_func_compatibility()
4988 func_id != BPF_FUNC_sk_select_reuseport && in check_map_func_compatibility()
4989 func_id != BPF_FUNC_map_lookup_elem && in check_map_func_compatibility()
4990 !may_update_sockmap(env, func_id)) in check_map_func_compatibility()
4994 if (func_id != BPF_FUNC_sk_redirect_hash && in check_map_func_compatibility()
4995 func_id != BPF_FUNC_sock_hash_update && in check_map_func_compatibility()
4996 func_id != BPF_FUNC_map_delete_elem && in check_map_func_compatibility()
4997 func_id != BPF_FUNC_msg_redirect_hash && in check_map_func_compatibility()
4998 func_id != BPF_FUNC_sk_select_reuseport && in check_map_func_compatibility()
4999 func_id != BPF_FUNC_map_lookup_elem && in check_map_func_compatibility()
5000 !may_update_sockmap(env, func_id)) in check_map_func_compatibility()
5004 if (func_id != BPF_FUNC_sk_select_reuseport) in check_map_func_compatibility()
5009 if (func_id != BPF_FUNC_map_peek_elem && in check_map_func_compatibility()
5010 func_id != BPF_FUNC_map_pop_elem && in check_map_func_compatibility()
5011 func_id != BPF_FUNC_map_push_elem) in check_map_func_compatibility()
5015 if (func_id != BPF_FUNC_sk_storage_get && in check_map_func_compatibility()
5016 func_id != BPF_FUNC_sk_storage_delete) in check_map_func_compatibility()
5020 if (func_id != BPF_FUNC_inode_storage_get && in check_map_func_compatibility()
5021 func_id != BPF_FUNC_inode_storage_delete) in check_map_func_compatibility()
5029 switch (func_id) { in check_map_func_compatibility()
5115 map->map_type, func_id_name(func_id), func_id); in check_map_func_compatibility()
5168 static bool check_refcount_ok(const struct bpf_func_proto *fn, int func_id) in check_refcount_ok() argument
5186 if (may_be_acquire_function(func_id) && count) in check_refcount_ok()
5210 static int check_func_proto(const struct bpf_func_proto *fn, int func_id) in check_func_proto() argument
5215 check_refcount_ok(fn, func_id) ? 0 : -EINVAL; in check_func_proto()
5440 int func_id, in do_refine_retval_range() argument
5446 (func_id != BPF_FUNC_get_stack && in do_refine_retval_range()
5447 func_id != BPF_FUNC_probe_read_str && in do_refine_retval_range()
5448 func_id != BPF_FUNC_probe_read_kernel_str && in do_refine_retval_range()
5449 func_id != BPF_FUNC_probe_read_user_str)) in do_refine_retval_range()
5461 int func_id, int insn_idx) in record_func_map() argument
5466 if (func_id != BPF_FUNC_tail_call && in record_func_map()
5467 func_id != BPF_FUNC_map_lookup_elem && in record_func_map()
5468 func_id != BPF_FUNC_map_update_elem && in record_func_map()
5469 func_id != BPF_FUNC_map_delete_elem && in record_func_map()
5470 func_id != BPF_FUNC_map_push_elem && in record_func_map()
5471 func_id != BPF_FUNC_map_pop_elem && in record_func_map()
5472 func_id != BPF_FUNC_map_peek_elem) in record_func_map()
5485 (func_id == BPF_FUNC_map_delete_elem || in record_func_map()
5486 func_id == BPF_FUNC_map_update_elem || in record_func_map()
5487 func_id == BPF_FUNC_map_push_elem || in record_func_map()
5488 func_id == BPF_FUNC_map_pop_elem)) { in record_func_map()
5504 int func_id, int insn_idx) in record_func_key() argument
5512 if (func_id != BPF_FUNC_tail_call) in record_func_key()
5551 static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn_idx) in check_helper_call() argument
5560 if (func_id < 0 || func_id >= __BPF_FUNC_MAX_ID) { in check_helper_call()
5561 verbose(env, "invalid func %s#%d\n", func_id_name(func_id), in check_helper_call()
5562 func_id); in check_helper_call()
5567 fn = env->ops->get_func_proto(func_id, env->prog); in check_helper_call()
5569 verbose(env, "unknown func %s#%d\n", func_id_name(func_id), in check_helper_call()
5570 func_id); in check_helper_call()
5589 func_id_name(func_id), func_id); in check_helper_call()
5596 err = check_func_proto(fn, func_id); in check_helper_call()
5599 func_id_name(func_id), func_id); in check_helper_call()
5603 meta.func_id = func_id; in check_helper_call()
5611 err = record_func_map(env, &meta, func_id, insn_idx); in check_helper_call()
5615 err = record_func_key(env, &meta, func_id, insn_idx); in check_helper_call()
5629 if (func_id == BPF_FUNC_tail_call) { in check_helper_call()
5635 } else if (is_release_function(func_id)) { in check_helper_call()
5639 func_id_name(func_id), func_id); in check_helper_call()
5649 if (func_id == BPF_FUNC_get_local_storage && in check_helper_call()
5741 fn->ret_type, func_id_name(func_id), func_id); in check_helper_call()
5747 fn->ret_type, func_id_name(func_id), func_id); in check_helper_call()
5754 if (is_ptr_cast_function(func_id)) { in check_helper_call()
5757 } else if (is_acquire_function(func_id, meta.map_ptr)) { in check_helper_call()
5768 do_refine_retval_range(regs, fn->ret_type, func_id, &meta); in check_helper_call()
5770 err = check_map_func_compatibility(env, meta.map_ptr, func_id); in check_helper_call()
5774 if ((func_id == BPF_FUNC_get_stack || in check_helper_call()
5775 func_id == BPF_FUNC_get_task_stack) && in check_helper_call()
5787 verbose(env, err_str, func_id_name(func_id), func_id); in check_helper_call()
5794 if (func_id == BPF_FUNC_get_stackid || func_id == BPF_FUNC_get_stack) in check_helper_call()