• Home
  • Raw
  • Download

Lines Matching refs:prog

277 	const struct bpf_prog *prog;  in find_linfo()  local
280 prog = env->prog; in find_linfo()
281 nr_linfo = prog->aux->nr_linfo; in find_linfo()
283 if (!nr_linfo || insn_off >= prog->len) in find_linfo()
286 linfo = prog->aux->linfo; in find_linfo()
406 ltrim(btf_name_by_offset(env->prog->aux->btf, in verbose_linfo()
1866 int insn_cnt = env->prog->len; in add_subprog()
1931 find_kfunc_desc(const struct bpf_prog *prog, u32 func_id, u16 offset) in find_kfunc_desc() argument
1939 tab = prog->aux->kfunc_tab; in find_kfunc_desc()
1954 tab = env->prog->aux->kfunc_btf_tab; in __find_kfunc_desc_btf()
2043 prog_aux = env->prog->aux; in add_kfunc_call()
2052 if (!env->prog->jit_requested) { in add_kfunc_call()
2062 if (!env->prog->gpl_compatible) { in add_kfunc_call()
2095 if (find_kfunc_desc(env->prog, func_id, offset)) in add_kfunc_call()
2157 static void sort_kfunc_descs_by_imm(struct bpf_prog *prog) in sort_kfunc_descs_by_imm() argument
2161 tab = prog->aux->kfunc_tab; in sort_kfunc_descs_by_imm()
2169 bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog) in bpf_prog_has_kfunc_call() argument
2171 return !!prog->aux->kfunc_tab; in bpf_prog_has_kfunc_call()
2175 bpf_jit_find_kfunc_model(const struct bpf_prog *prog, in bpf_jit_find_kfunc_model() argument
2184 tab = prog->aux->kfunc_tab; in bpf_jit_find_kfunc_model()
2194 struct bpf_insn *insn = env->prog->insnsi; in add_subprog_and_kfunc()
2195 int i, ret, insn_cnt = env->prog->len; in add_subprog_and_kfunc()
2237 struct bpf_insn *insn = env->prog->insnsi; in check_subprogs()
2238 int insn_cnt = env->prog->len; in check_subprogs()
2473 struct bpf_insn *insn = env->prog->insnsi + env->insn_idx; in check_reg_arg()
2597 struct bpf_insn *insn = env->prog->insnsi + idx; in backtrack_insn()
3058 if (i >= env->prog->len) { in __mark_chain_precision()
3259 struct bpf_insn *insn = &env->prog->insnsi[insn_idx]; in check_stack_write_fixed_off()
4001 struct bpf_insn *insn = &env->prog->insnsi[insn_idx]; in check_map_kptr_access()
4130 enum bpf_prog_type prog_type = resolve_prog_type(env->prog); in may_access_direct_pkt_data()
4203 env->prog->aux->max_pkt_offset = in check_packet_access()
4204 max_t(u32, env->prog->aux->max_pkt_offset, in check_packet_access()
4221 env->ops->is_valid_access(off, size, t, env->prog, &info)) { in check_ctx_access()
4238 if (env->prog->aux->max_ctx_offset < off + size) in check_ctx_access()
4239 env->prog->aux->max_ctx_offset = off + size; in check_ctx_access()
4473 struct bpf_insn *insn = env->prog->insnsi; in check_max_stack_depth_subprog()
4567 env->prog->aux->tail_call_reachable = true; in check_max_stack_depth_subprog()
4647 if (off + size > env->prog->aux->max_tp_access) in check_tp_buffer_access()
4648 env->prog->aux->max_tp_access = off + size; in check_tp_buffer_access()
5189 max_access = &env->prog->aux->max_rdonly_access; in check_mem_access()
5191 max_access = &env->prog->aux->max_rdwr_access; in check_mem_access()
5500 max_access = &env->prog->aux->max_rdonly_access; in check_helper_mem_access()
5502 max_access = &env->prog->aux->max_rdwr_access; in check_helper_mem_access()
6470 enum bpf_attach_type eatype = env->prog->expected_attach_type; in may_update_sockmap()
6471 enum bpf_prog_type type = resolve_prog_type(env->prog); in may_update_sockmap()
6502 return env->prog->jit_requested && in allow_tail_call_in_subprogs()
6935 func_info_aux = env->prog->aux->func_info_aux; in __check_func_call()
7468 enum bpf_prog_type type = resolve_prog_type(env->prog); in check_get_func_ip()
7472 if (!bpf_prog_has_trampoline(env->prog)) { in check_get_func_ip()
7525 enum bpf_prog_type prog_type = resolve_prog_type(env->prog); in check_helper_call()
7544 fn = env->ops->get_func_proto(func_id, env->prog); in check_helper_call()
7552 if (!env->prog->gpl_compatible && fn->gpl_only) { in check_helper_call()
7557 if (fn->allowed && !fn->allowed(env->prog)) { in check_helper_call()
7688 env->prog->expected_attach_type == BPF_LSM_CGROUP) { in check_helper_call()
7689 if (!env->prog->aux->attach_func_proto->type) { in check_helper_call()
7890 !env->prog->has_callchain_buf) { in check_helper_call()
7905 env->prog->has_callchain_buf = true; in check_helper_call()
7909 env->prog->call_get_stack = true; in check_helper_call()
7914 env->prog->call_get_func_ip = true; in check_helper_call()
7973 kfunc_flags = btf_kfunc_id_set_contains(desc_btf, resolve_prog_type(env->prog), func_id); in check_kfunc_call()
10667 struct bpf_prog_aux *aux = env->prog->aux; in check_ld_imm()
10739 if (!may_access_skb(resolve_prog_type(env->prog))) { in check_ld_abs()
10812 const struct bpf_prog *prog = env->prog; in check_return_code() local
10815 enum bpf_prog_type prog_type = resolve_prog_type(env->prog); in check_return_code()
10824 if (prog->expected_attach_type == BPF_LSM_CGROUP) in check_return_code()
10829 if (!prog->aux->attach_func_proto->type) in check_return_code()
10880 if (env->prog->expected_attach_type == BPF_CGROUP_UDP4_RECVMSG || in check_return_code()
10881 env->prog->expected_attach_type == BPF_CGROUP_UDP6_RECVMSG || in check_return_code()
10882 env->prog->expected_attach_type == BPF_CGROUP_INET4_GETPEERNAME || in check_return_code()
10883 env->prog->expected_attach_type == BPF_CGROUP_INET6_GETPEERNAME || in check_return_code()
10884 env->prog->expected_attach_type == BPF_CGROUP_INET4_GETSOCKNAME || in check_return_code()
10885 env->prog->expected_attach_type == BPF_CGROUP_INET6_GETSOCKNAME) in check_return_code()
10887 if (env->prog->expected_attach_type == BPF_CGROUP_INET4_BIND || in check_return_code()
10888 env->prog->expected_attach_type == BPF_CGROUP_INET6_BIND) in check_return_code()
10892 if (env->prog->expected_attach_type == BPF_CGROUP_INET_EGRESS) { in check_return_code()
10904 if (!env->prog->aux->attach_btf_id) in check_return_code()
10909 switch (env->prog->expected_attach_type) { in check_return_code()
10928 if (env->prog->expected_attach_type != BPF_LSM_CGROUP) { in check_return_code()
10934 if (!env->prog->aux->attach_func_proto->type) { in check_return_code()
10958 if (prog->expected_attach_type == BPF_LSM_CGROUP && in check_return_code()
10960 !prog->aux->attach_func_proto->type) in check_return_code()
10967 env->prog->enforce_expected_attach_type = 1; in check_return_code()
11013 return env->prog->len; in state_htab_size()
11053 if (w < 0 || w >= env->prog->len) { in push_insn()
11067 if (env->cfg.cur_stack >= env->prog->len) in push_insn()
11120 struct bpf_insn *insns = env->prog->insnsi; in visit_insn()
11185 int insn_cnt = env->prog->len; in check_cfg()
11276 struct bpf_prog *prog; in check_btf_func() local
11303 prog = env->prog; in check_btf_func()
11304 btf = prog->aux->btf; in check_btf_func()
11387 prog->aux->func_info = krecord; in check_btf_func()
11388 prog->aux->func_info_cnt = nfuncs; in check_btf_func()
11389 prog->aux->func_info_aux = info_aux; in check_btf_func()
11400 struct bpf_prog_aux *aux = env->prog->aux; in adjust_btf_func()
11420 struct bpf_prog *prog; in check_btf_line() local
11445 prog = env->prog; in check_btf_line()
11446 btf = prog->aux->btf; in check_btf_line()
11483 linfo[i].insn_off >= prog->len) { in check_btf_line()
11486 prog->len); in check_btf_line()
11491 if (!prog->insnsi[linfo[i].insn_off].code) { in check_btf_line()
11528 prog->aux->linfo = linfo; in check_btf_line()
11529 prog->aux->nr_linfo = nr_linfo; in check_btf_line()
11547 struct bpf_prog *prog = env->prog; in check_core_relo() local
11548 const struct btf *btf = prog->aux->btf; in check_core_relo()
11594 if (core_relo.insn_off % 8 || core_relo.insn_off / 8 >= prog->len) { in check_core_relo()
11596 i, core_relo.insn_off, prog->len); in check_core_relo()
11602 &prog->insnsi[core_relo.insn_off / 8]); in check_core_relo()
11630 env->prog->aux->btf = btf; in check_btf_info()
12459 struct bpf_insn *insns = env->prog->insnsi; in do_check()
12461 int insn_cnt = env->prog->len; in do_check()
12537 if (bpf_prog_is_dev_bound(env->prog->aux)) { in do_check()
12973 struct bpf_prog *prog) in check_map_prog_compatibility() argument
12976 enum bpf_prog_type prog_type = resolve_prog_type(prog); in check_map_prog_compatibility()
12989 if (prog->aux->sleepable) { in check_map_prog_compatibility()
13002 if ((bpf_prog_is_dev_bound(prog->aux) || bpf_map_is_dev_bound(map)) && in check_map_prog_compatibility()
13003 !bpf_offload_prog_map_match(prog, map)) { in check_map_prog_compatibility()
13013 if (prog->aux->sleepable) in check_map_prog_compatibility()
13053 struct bpf_insn *insn = env->prog->insnsi; in resolve_pseudo_ldimm64()
13054 int insn_cnt = env->prog->len; in resolve_pseudo_ldimm64()
13057 err = bpf_prog_calc_tag(env->prog); in resolve_pseudo_ldimm64()
13142 err = check_map_prog_compatibility(env, map, env->prog); in resolve_pseudo_ldimm64()
13207 bpf_cgroup_storage_assign(env->prog->aux, map)) { in resolve_pseudo_ldimm64()
13237 __bpf_free_used_maps(env->prog->aux, env->used_maps, in release_maps()
13244 __bpf_free_used_btfs(env->prog->aux, env->used_btfs, in release_btfs()
13251 struct bpf_insn *insn = env->prog->insnsi; in convert_pseudo_ld_imm64()
13252 int insn_cnt = env->prog->len; in convert_pseudo_ld_imm64()
13314 static void adjust_poke_descs(struct bpf_prog *prog, u32 off, u32 len) in adjust_poke_descs() argument
13316 struct bpf_jit_poke_descriptor *tab = prog->aux->poke_tab; in adjust_poke_descs()
13317 int i, sz = prog->aux->size_poke_tab; in adjust_poke_descs()
13335 new_data = vzalloc(array_size(env->prog->len + len - 1, in bpf_patch_insn_data()
13341 new_prog = bpf_patch_insn_single(env->prog, off, patch, len); in bpf_patch_insn_data()
13376 struct bpf_prog_aux *aux = env->prog->aux; in adjust_subprog_starts_after_remove()
13415 struct bpf_prog *prog = env->prog; in bpf_adj_linfo_after_remove() local
13419 nr_linfo = prog->aux->nr_linfo; in bpf_adj_linfo_after_remove()
13423 linfo = prog->aux->linfo; in bpf_adj_linfo_after_remove()
13442 if (prog->len != off && l_cnt && in bpf_adj_linfo_after_remove()
13453 prog->aux->nr_linfo -= l_cnt; in bpf_adj_linfo_after_remove()
13454 nr_linfo = prog->aux->nr_linfo; in bpf_adj_linfo_after_remove()
13479 unsigned int orig_prog_len = env->prog->len; in verifier_remove_insns()
13482 if (bpf_prog_is_dev_bound(env->prog->aux)) in verifier_remove_insns()
13485 err = bpf_remove_insns(env->prog, off, cnt); in verifier_remove_insns()
13518 struct bpf_insn *insn = env->prog->insnsi; in sanitize_dead_code()
13519 const int insn_cnt = env->prog->len; in sanitize_dead_code()
13548 struct bpf_insn *insn = env->prog->insnsi; in opt_hard_wire_dead_code_branches()
13549 const int insn_cnt = env->prog->len; in opt_hard_wire_dead_code_branches()
13563 if (bpf_prog_is_dev_bound(env->prog->aux)) in opt_hard_wire_dead_code_branches()
13573 int insn_cnt = env->prog->len; in opt_remove_dead_code()
13588 insn_cnt = env->prog->len; in opt_remove_dead_code()
13597 struct bpf_insn *insn = env->prog->insnsi; in opt_remove_nops()
13598 int insn_cnt = env->prog->len; in opt_remove_nops()
13620 int i, patch_len, delta = 0, len = env->prog->len; in opt_subreg_zext_lo32_rnd_hi32()
13621 struct bpf_insn *insns = env->prog->insnsi; in opt_subreg_zext_lo32_rnd_hi32()
13705 env->prog = new_prog; in opt_subreg_zext_lo32_rnd_hi32()
13723 const int insn_cnt = env->prog->len; in convert_ctx_accesses()
13736 env->prog); in convert_ctx_accesses()
13745 env->prog = new_prog; in convert_ctx_accesses()
13750 if (bpf_prog_is_dev_bound(env->prog->aux)) in convert_ctx_accesses()
13753 insn = env->prog->insnsi + delta; in convert_ctx_accesses()
13792 env->prog = new_prog; in convert_ctx_accesses()
13821 env->prog->aux->num_exentries++; in convert_ctx_accesses()
13858 cnt = convert_ctx_access(type, insn, insn_buf, env->prog, in convert_ctx_accesses()
13897 env->prog = new_prog; in convert_ctx_accesses()
13906 struct bpf_prog *prog = env->prog, **func, *tmp; in jit_subprogs() local
13916 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
13948 err = bpf_prog_alloc_jited_linfo(prog); in jit_subprogs()
13953 func = kcalloc(env->subprog_cnt, sizeof(prog), GFP_KERNEL); in jit_subprogs()
13970 memcpy(func[i]->insnsi, &prog->insnsi[subprog_start], in jit_subprogs()
13972 func[i]->type = prog->type; in jit_subprogs()
13979 func[i]->aux->btf = prog->aux->btf; in jit_subprogs()
13980 func[i]->aux->func_info = prog->aux->func_info; in jit_subprogs()
13981 func[i]->aux->func_info_cnt = prog->aux->func_info_cnt; in jit_subprogs()
13982 func[i]->aux->poke_tab = prog->aux->poke_tab; in jit_subprogs()
13983 func[i]->aux->size_poke_tab = prog->aux->size_poke_tab; in jit_subprogs()
13985 for (j = 0; j < prog->aux->size_poke_tab; j++) { in jit_subprogs()
13988 poke = &prog->aux->poke_tab[j]; in jit_subprogs()
13997 func[i]->blinding_requested = prog->blinding_requested; in jit_subprogs()
13998 func[i]->aux->kfunc_tab = prog->aux->kfunc_tab; in jit_subprogs()
13999 func[i]->aux->kfunc_btf_tab = prog->aux->kfunc_btf_tab; in jit_subprogs()
14000 func[i]->aux->linfo = prog->aux->linfo; in jit_subprogs()
14001 func[i]->aux->nr_linfo = prog->aux->nr_linfo; in jit_subprogs()
14002 func[i]->aux->jited_linfo = prog->aux->jited_linfo; in jit_subprogs()
14078 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
14092 prog->jited = 1; in jit_subprogs()
14093 prog->bpf_func = func[0]->bpf_func; in jit_subprogs()
14094 prog->jited_len = func[0]->jited_len; in jit_subprogs()
14095 prog->aux->extable = func[0]->aux->extable; in jit_subprogs()
14096 prog->aux->num_exentries = func[0]->aux->num_exentries; in jit_subprogs()
14097 prog->aux->func = func; in jit_subprogs()
14098 prog->aux->func_cnt = env->subprog_cnt; in jit_subprogs()
14099 bpf_prog_jit_attempt_done(prog); in jit_subprogs()
14106 for (i = 0; i < prog->aux->size_poke_tab; i++) { in jit_subprogs()
14107 map_ptr = prog->aux->poke_tab[i].tail_call.map; in jit_subprogs()
14108 map_ptr->ops->map_poke_untrack(map_ptr, prog->aux); in jit_subprogs()
14123 prog->jit_requested = 0; in jit_subprogs()
14124 prog->blinding_requested = 0; in jit_subprogs()
14125 for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { in jit_subprogs()
14131 bpf_prog_jit_attempt_done(prog); in jit_subprogs()
14138 struct bpf_prog *prog = env->prog; in fixup_call_args() local
14139 struct bpf_insn *insn = prog->insnsi; in fixup_call_args()
14140 bool has_kfunc_call = bpf_prog_has_kfunc_call(prog); in fixup_call_args()
14145 if (env->prog->jit_requested && in fixup_call_args()
14146 !bpf_prog_is_dev_bound(env->prog->aux)) { in fixup_call_args()
14158 if (env->subprog_cnt > 1 && env->prog->aux->tail_call_reachable) { in fixup_call_args()
14165 for (i = 0; i < prog->len; i++, insn++) { in fixup_call_args()
14199 desc = find_kfunc_desc(env->prog, insn->imm, insn->off); in fixup_kfunc_call()
14216 struct bpf_prog *prog = env->prog; in do_misc_fixups() local
14217 enum bpf_attach_type eatype = prog->expected_attach_type; in do_misc_fixups()
14218 enum bpf_prog_type prog_type = resolve_prog_type(prog); in do_misc_fixups()
14219 struct bpf_insn *insn = prog->insnsi; in do_misc_fixups()
14221 const int insn_cnt = prog->len; in do_misc_fixups()
14266 env->prog = prog = new_prog; in do_misc_fixups()
14286 env->prog = prog = new_prog; in do_misc_fixups()
14339 env->prog = prog = new_prog; in do_misc_fixups()
14356 prog->dst_needed = 1; in do_misc_fixups()
14360 prog->kprobe_override = 1; in do_misc_fixups()
14367 prog->cb_access = 1; in do_misc_fixups()
14369 prog->aux->stack_depth = MAX_BPF_STACK; in do_misc_fixups()
14370 prog->aux->max_pkt_offset = MAX_PACKET_OFF; in do_misc_fixups()
14381 if (env->bpf_capable && !prog->blinding_requested && in do_misc_fixups()
14382 prog->jit_requested && in do_misc_fixups()
14393 ret = bpf_jit_add_poke_descriptor(prog, &desc); in do_misc_fixups()
14431 env->prog = prog = new_prog; in do_misc_fixups()
14451 BPF_LD_IMM64(BPF_REG_3, (long)prog->aux), in do_misc_fixups()
14464 env->prog = prog = new_prog; in do_misc_fixups()
14472 if (env->prog->aux->sleepable) in do_misc_fixups()
14484 env->prog = prog = new_prog; in do_misc_fixups()
14493 if (prog->jit_requested && BITS_PER_LONG == 64 && in do_misc_fixups()
14525 env->prog = prog = new_prog; in do_misc_fixups()
14589 if (prog->jit_requested && BITS_PER_LONG == 64 && in do_misc_fixups()
14608 env->prog = prog = new_prog; in do_misc_fixups()
14633 env->prog = prog = new_prog; in do_misc_fixups()
14661 env->prog = prog = new_prog; in do_misc_fixups()
14676 env->prog = prog = new_prog; in do_misc_fixups()
14691 env->prog = prog = new_prog; in do_misc_fixups()
14697 fn = env->ops->get_func_proto(insn->imm, env->prog); in do_misc_fixups()
14711 for (i = 0; i < prog->aux->size_poke_tab; i++) { in do_misc_fixups()
14712 map_ptr = prog->aux->poke_tab[i].tail_call.map; in do_misc_fixups()
14720 ret = map_ptr->ops->map_poke_track(map_ptr, prog->aux); in do_misc_fixups()
14727 sort_kfunc_descs_by_imm(env->prog); in do_misc_fixups()
14827 struct bpf_insn *insn = env->prog->insnsi; in optimize_bpf_loop()
14828 int insn_cnt = env->prog->len; in optimize_bpf_loop()
14850 env->prog = new_prog; in optimize_bpf_loop()
14863 env->prog->aux->stack_depth = env->subprog_info[0].stack_depth; in optimize_bpf_loop()
14928 if (subprog || env->prog->type == BPF_PROG_TYPE_EXT) { in do_check_common()
14998 struct bpf_prog_aux *aux = env->prog->aux; in do_check_subprogs()
15028 env->prog->aux->stack_depth = env->subprog_info[0].stack_depth; in do_check_main()
15062 struct bpf_prog *prog = env->prog; in check_struct_ops_btf_id() local
15066 if (!prog->gpl_compatible) { in check_struct_ops_btf_id()
15071 btf_id = prog->aux->attach_btf_id; in check_struct_ops_btf_id()
15080 member_idx = prog->expected_attach_type; in check_struct_ops_btf_id()
15107 prog->aux->attach_func_proto = func_proto; in check_struct_ops_btf_id()
15108 prog->aux->attach_func_name = mname; in check_struct_ops_btf_id()
15142 const struct bpf_prog *prog, in bpf_check_attach_target() argument
15147 bool prog_extension = prog->type == BPF_PROG_TYPE_EXT; in bpf_check_attach_target()
15160 btf = tgt_prog ? tgt_prog->aux->btf : prog->aux->attach_btf; in bpf_check_attach_target()
15195 if (!prog->jit_requested) { in bpf_check_attach_target()
15205 if (tgt_prog->type == prog->type) { in bpf_check_attach_target()
15242 switch (prog->expected_attach_type) { in bpf_check_attach_target()
15298 btf_check_type_match(log, prog, btf, t)) in bpf_check_attach_target()
15304 if ((prog->aux->saved_dst_prog_type || prog->aux->saved_dst_attach_type) && in bpf_check_attach_target()
15305 (!tgt_prog || prog->aux->saved_dst_prog_type != tgt_prog->type || in bpf_check_attach_target()
15306 prog->aux->saved_dst_attach_type != tgt_prog->expected_attach_type)) in bpf_check_attach_target()
15331 if (prog->aux->sleepable) { in bpf_check_attach_target()
15333 switch (prog->type) { in bpf_check_attach_target()
15356 } else if (prog->expected_attach_type == BPF_MODIFY_RETURN) { in bpf_check_attach_target()
15393 struct bpf_prog *prog = env->prog; in BTF_SET_START() local
15394 struct bpf_prog *tgt_prog = prog->aux->dst_prog; in BTF_SET_START()
15396 u32 btf_id = prog->aux->attach_btf_id; in BTF_SET_START()
15401 if (prog->type == BPF_PROG_TYPE_SYSCALL) { in BTF_SET_START()
15402 if (prog->aux->sleepable) in BTF_SET_START()
15409 if (prog->aux->sleepable && prog->type != BPF_PROG_TYPE_TRACING && in BTF_SET_START()
15410 prog->type != BPF_PROG_TYPE_LSM && prog->type != BPF_PROG_TYPE_KPROBE) { in BTF_SET_START()
15415 if (prog->type == BPF_PROG_TYPE_STRUCT_OPS) in BTF_SET_START()
15418 if (prog->type != BPF_PROG_TYPE_TRACING && in BTF_SET_START()
15419 prog->type != BPF_PROG_TYPE_LSM && in BTF_SET_START()
15420 prog->type != BPF_PROG_TYPE_EXT) in BTF_SET_START()
15423 ret = bpf_check_attach_target(&env->log, prog, tgt_prog, btf_id, &tgt_info); in BTF_SET_START()
15427 if (tgt_prog && prog->type == BPF_PROG_TYPE_EXT) { in BTF_SET_START()
15433 prog->expected_attach_type = tgt_prog->expected_attach_type; in BTF_SET_START()
15437 prog->aux->attach_func_proto = tgt_info.tgt_type; in BTF_SET_START()
15438 prog->aux->attach_func_name = tgt_info.tgt_name; in BTF_SET_START()
15441 prog->aux->saved_dst_prog_type = tgt_prog->type; in BTF_SET_START()
15442 prog->aux->saved_dst_attach_type = tgt_prog->expected_attach_type; in BTF_SET_START()
15445 if (prog->expected_attach_type == BPF_TRACE_RAW_TP) { in BTF_SET_START()
15446 prog->aux->attach_btf_trace = true; in BTF_SET_START()
15448 } else if (prog->expected_attach_type == BPF_TRACE_ITER) { in BTF_SET_START()
15449 if (!bpf_iter_prog_supported(prog)) in BTF_SET_START()
15454 if (prog->type == BPF_PROG_TYPE_LSM) { in BTF_SET_START()
15455 ret = bpf_lsm_verify_prog(&env->log, prog); in BTF_SET_START()
15458 } else if (prog->type == BPF_PROG_TYPE_TRACING && in BTF_SET_START()
15463 key = bpf_trampoline_compute_key(tgt_prog, prog->aux->attach_btf, btf_id); in BTF_SET_START()
15471 prog->aux->dst_trampoline = tr; in BTF_SET_START()
15486 int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr) in bpf_check() argument
15506 len = (*prog)->len; in bpf_check()
15514 env->prog = *prog; in bpf_check()
15515 env->ops = bpf_verifier_ops[env->prog->type]; in bpf_check()
15592 if (bpf_prog_is_dev_bound(env->prog->aux)) { in bpf_check()
15593 ret = bpf_prog_offload_verifier_prep(env->prog); in bpf_check()
15605 if (ret == 0 && bpf_prog_is_dev_bound(env->prog->aux)) in bpf_check()
15640 if (ret == 0 && !bpf_prog_is_dev_bound(env->prog->aux)) { in bpf_check()
15642 env->prog->aux->verifier_zext = bpf_jit_needs_zext() ? !ret in bpf_check()
15651 env->prog->aux->verified_insns = env->insn_processed; in bpf_check()
15665 env->prog->aux->used_maps = kmalloc_array(env->used_map_cnt, in bpf_check()
15669 if (!env->prog->aux->used_maps) { in bpf_check()
15674 memcpy(env->prog->aux->used_maps, env->used_maps, in bpf_check()
15676 env->prog->aux->used_map_cnt = env->used_map_cnt; in bpf_check()
15680 env->prog->aux->used_btfs = kmalloc_array(env->used_btf_cnt, in bpf_check()
15683 if (!env->prog->aux->used_btfs) { in bpf_check()
15688 memcpy(env->prog->aux->used_btfs, env->used_btfs, in bpf_check()
15690 env->prog->aux->used_btf_cnt = env->used_btf_cnt; in bpf_check()
15702 if (!env->prog->aux->used_maps) in bpf_check()
15707 if (!env->prog->aux->used_btfs) in bpf_check()
15713 if (env->prog->type == BPF_PROG_TYPE_EXT) in bpf_check()
15714 env->prog->expected_attach_type = 0; in bpf_check()
15716 *prog = env->prog; in bpf_check()