Lines Matching refs:subprog
491 static bool subprog_is_global(const struct bpf_verifier_env *env, int subprog) in subprog_is_global() argument
495 return aux && aux[subprog].linkage == BTF_FUNC_GLOBAL; in subprog_is_global()
2582 int subprog) in push_async_cb() argument
2615 subprog /* subprog number within this prog */); in push_async_cb()
3018 struct bpf_subprog_info *subprog = env->subprog_info; in add_subprog_and_kfunc() local
3049 subprog[env->subprog_cnt].start = insn_cnt; in add_subprog_and_kfunc()
3053 verbose(env, "func#%d @%d\n", i, subprog[i].start); in add_subprog_and_kfunc()
3061 struct bpf_subprog_info *subprog = env->subprog_info; in check_subprogs() local
3066 subprog_start = subprog[cur_subprog].start; in check_subprogs()
3067 subprog_end = subprog[cur_subprog + 1].start; in check_subprogs()
3074 subprog[cur_subprog].has_tail_call = true; in check_subprogs()
3075 subprog[cur_subprog].tail_call_reachable = true; in check_subprogs()
3079 subprog[cur_subprog].has_ld_abs = true; in check_subprogs()
3107 subprog_end = subprog[cur_subprog + 1].start; in check_subprogs()
3763 int subprog_insn_idx, subprog; in backtrack_insn() local
3766 subprog = find_subprog(env, subprog_insn_idx); in backtrack_insn()
3767 if (subprog < 0) in backtrack_insn()
3770 if (subprog_is_global(env, subprog)) { in backtrack_insn()
5842 struct bpf_subprog_info *subprog = env->subprog_info; in check_max_stack_depth_subprog() local
5850 i = subprog[idx].start; in check_max_stack_depth_subprog()
5871 if (idx && subprog[idx].has_tail_call && depth >= 256) { in check_max_stack_depth_subprog()
5880 depth += round_up(max_t(u32, subprog[idx].stack_depth, 1), 32); in check_max_stack_depth_subprog()
5887 subprog_end = subprog[idx + 1].start; in check_max_stack_depth_subprog()
5905 if (subprog[sidx].is_async_cb) { in check_max_stack_depth_subprog()
5906 if (subprog[sidx].has_tail_call) { in check_max_stack_depth_subprog()
5917 if (subprog[idx].has_tail_call) in check_max_stack_depth_subprog()
5935 subprog[ret_prog[j]].tail_call_reachable = true; in check_max_stack_depth_subprog()
5936 if (subprog[0].tail_call_reachable) in check_max_stack_depth_subprog()
5944 depth -= round_up(max_t(u32, subprog[idx].stack_depth, 1), 32); in check_max_stack_depth_subprog()
5971 int start = idx + insn->imm + 1, subprog; in get_callee_stack_depth() local
5973 subprog = find_subprog(env, start); in get_callee_stack_depth()
5974 if (subprog < 0) { in get_callee_stack_depth()
5979 return env->subprog_info[subprog].stack_depth; in get_callee_stack_depth()
9200 static int setup_func_entry(struct bpf_verifier_env *env, int subprog, int callsite, in setup_func_entry() argument
9233 subprog /* subprog number within this prog */); in setup_func_entry()
9252 int insn_idx, int subprog, in push_callback_call() argument
9260 err = btf_check_subprog_call(env, subprog, caller->regs); in push_callback_call()
9286 env->subprog_info[subprog].is_async_cb = true; in push_callback_call()
9287 async_cb = push_async_cb(env, env->subprog_info[subprog].start, in push_callback_call()
9288 insn_idx, subprog); in push_callback_call()
9305 callback_state = push_stack(env, env->subprog_info[subprog].start, insn_idx, false); in push_callback_call()
9309 err = setup_func_entry(env, subprog, insn_idx, set_callee_state_cb, in push_callback_call()
9325 int err, subprog, target_insn; in check_func_call() local
9328 subprog = find_subprog(env, target_insn); in check_func_call()
9329 if (subprog < 0) { in check_func_call()
9335 err = btf_check_subprog_call(env, subprog, caller->regs); in check_func_call()
9338 if (subprog_is_global(env, subprog)) { in check_func_call()
9340 verbose(env, "Caller passes invalid args into func#%d\n", subprog); in check_func_call()
9345 verbose(env, "Func#%d is global and valid. Skipping.\n", subprog); in check_func_call()
9359 err = setup_func_entry(env, subprog, *insn_idx, set_callee_state, state); in check_func_call()
9366 *insn_idx = env->subprog_info[subprog].start - 1; in check_func_call()
18464 int i, j, subprog_start, subprog_end = 0, len, subprog; in jit_subprogs() local
18481 subprog = find_subprog(env, i + insn->imm + 1); in jit_subprogs()
18482 if (subprog < 0) { in jit_subprogs()
18490 insn->off = subprog; in jit_subprogs()
18587 subprog = insn->off; in jit_subprogs()
18588 insn[0].imm = (u32)(long)func[subprog]->bpf_func; in jit_subprogs()
18589 insn[1].imm = ((u64)(long)func[subprog]->bpf_func) >> 32; in jit_subprogs()
18594 subprog = insn->off; in jit_subprogs()
18595 insn->imm = BPF_CALL_IMM(func[subprog]->bpf_func); in jit_subprogs()
18646 subprog = find_subprog(env, i + insn->off + 1); in jit_subprogs()
18647 insn->imm = subprog; in jit_subprogs()
19574 static int do_check_common(struct bpf_verifier_env *env, int subprog) in do_check_common() argument
19599 subprog); in do_check_common()
19600 state->first_insn_idx = env->subprog_info[subprog].start; in do_check_common()
19604 if (subprog || env->prog->type == BPF_PROG_TYPE_EXT) { in do_check_common()
19605 ret = btf_prepare_func_args(env, subprog, regs); in do_check_common()
19625 ret = btf_check_subprog_arg_match(env, subprog, regs); in do_check_common()
19825 int ret = 0, subprog = -1, i; in bpf_check_attach_target() local
19864 subprog = i; in bpf_check_attach_target()
19867 if (subprog == -1) { in bpf_check_attach_target()
19871 conservative = aux->func_info_aux[subprog].unreliable; in bpf_check_attach_target()
20000 if (subprog == 0) in bpf_check_attach_target()
20003 addr = (long) tgt_prog->aux->func[subprog]->bpf_func; in bpf_check_attach_target()