Lines Matching refs:fn
3610 static bool check_raw_mode_ok(const struct bpf_func_proto *fn) in check_raw_mode_ok() argument
3614 if (fn->arg1_type == ARG_PTR_TO_UNINIT_MEM) in check_raw_mode_ok()
3616 if (fn->arg2_type == ARG_PTR_TO_UNINIT_MEM) in check_raw_mode_ok()
3618 if (fn->arg3_type == ARG_PTR_TO_UNINIT_MEM) in check_raw_mode_ok()
3620 if (fn->arg4_type == ARG_PTR_TO_UNINIT_MEM) in check_raw_mode_ok()
3622 if (fn->arg5_type == ARG_PTR_TO_UNINIT_MEM) in check_raw_mode_ok()
3641 static bool check_arg_pair_ok(const struct bpf_func_proto *fn) in check_arg_pair_ok() argument
3648 if (arg_type_is_mem_size(fn->arg1_type) || in check_arg_pair_ok()
3649 arg_type_is_mem_ptr(fn->arg5_type) || in check_arg_pair_ok()
3650 check_args_pair_invalid(fn->arg1_type, fn->arg2_type) || in check_arg_pair_ok()
3651 check_args_pair_invalid(fn->arg2_type, fn->arg3_type) || in check_arg_pair_ok()
3652 check_args_pair_invalid(fn->arg3_type, fn->arg4_type) || in check_arg_pair_ok()
3653 check_args_pair_invalid(fn->arg4_type, fn->arg5_type)) in check_arg_pair_ok()
3659 static bool check_refcount_ok(const struct bpf_func_proto *fn, int func_id) in check_refcount_ok() argument
3663 if (arg_type_may_be_refcounted(fn->arg1_type)) in check_refcount_ok()
3665 if (arg_type_may_be_refcounted(fn->arg2_type)) in check_refcount_ok()
3667 if (arg_type_may_be_refcounted(fn->arg3_type)) in check_refcount_ok()
3669 if (arg_type_may_be_refcounted(fn->arg4_type)) in check_refcount_ok()
3671 if (arg_type_may_be_refcounted(fn->arg5_type)) in check_refcount_ok()
3686 static int check_func_proto(const struct bpf_func_proto *fn, int func_id) in check_func_proto() argument
3688 return check_raw_mode_ok(fn) && in check_func_proto()
3689 check_arg_pair_ok(fn) && in check_func_proto()
3690 check_refcount_ok(fn, func_id) ? 0 : -EINVAL; in check_func_proto()
3954 const struct bpf_func_proto *fn = NULL; in check_helper_call() local
3968 fn = env->ops->get_func_proto(func_id, env->prog); in check_helper_call()
3969 if (!fn) { in check_helper_call()
3976 if (!env->prog->gpl_compatible && fn->gpl_only) { in check_helper_call()
3982 changes_data = bpf_helper_changes_pkt_data(fn->func); in check_helper_call()
3983 if (changes_data && fn->arg1_type != ARG_PTR_TO_CTX) { in check_helper_call()
3990 meta.pkt_access = fn->pkt_access; in check_helper_call()
3992 err = check_func_proto(fn, func_id); in check_helper_call()
4001 err = check_func_arg(env, BPF_REG_1, fn->arg1_type, &meta); in check_helper_call()
4004 err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta); in check_helper_call()
4007 err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta); in check_helper_call()
4010 err = check_func_arg(env, BPF_REG_4, fn->arg4_type, &meta); in check_helper_call()
4013 err = check_func_arg(env, BPF_REG_5, fn->arg5_type, &meta); in check_helper_call()
4067 if (fn->ret_type == RET_INTEGER) { in check_helper_call()
4070 } else if (fn->ret_type == RET_VOID) { in check_helper_call()
4072 } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL || in check_helper_call()
4073 fn->ret_type == RET_PTR_TO_MAP_VALUE) { in check_helper_call()
4086 if (fn->ret_type == RET_PTR_TO_MAP_VALUE) { in check_helper_call()
4094 } else if (fn->ret_type == RET_PTR_TO_SOCKET_OR_NULL) { in check_helper_call()
4098 } else if (fn->ret_type == RET_PTR_TO_SOCK_COMMON_OR_NULL) { in check_helper_call()
4102 } else if (fn->ret_type == RET_PTR_TO_TCP_SOCK_OR_NULL) { in check_helper_call()
4108 fn->ret_type, func_id_name(func_id), func_id); in check_helper_call()
4126 do_refine_retval_range(regs, fn->ret_type, func_id, &meta); in check_helper_call()
8907 const struct bpf_func_proto *fn; in fixup_bpf_calls() local
9173 fn = env->ops->get_func_proto(insn->imm, env->prog); in fixup_bpf_calls()
9177 if (!fn->func) { in fixup_bpf_calls()
9183 insn->imm = fn->func - __bpf_call_base; in fixup_bpf_calls()