Lines Matching refs:btf_id
291 u32 btf_id; member
426 meta = btf_find_struct_meta(reg->btf, reg->btf_id); in reg_btf_record()
512 static bool is_sync_callback_calling_kfunc(u32 btf_id);
513 static bool is_async_callback_calling_kfunc(u32 btf_id);
514 static bool is_callback_calling_kfunc(u32 btf_id);
517 static bool is_bpf_wq_set_callback_impl_kfunc(u32 btf_id);
1009 struct btf *btf, u32 btf_id, int nr_slots) in mark_stack_slots_iter() argument
1036 st->iter.btf_id = btf_id; in mark_stack_slots_iter()
1107 struct btf *btf, u32 btf_id, int nr_slots) in is_iter_reg_valid_init() argument
1127 if (st->iter.btf != btf || st->iter.btf_id != btf_id) in is_iter_reg_valid_init()
2251 regs[regno].btf_id = ds_head->value_btf_id; in mark_reg_graph_node()
2834 struct btf *btf, u32 btf_id, in mark_btf_ld_reg() argument
2845 regs[regno].btf_id = btf_id; in mark_btf_ld_reg()
5755 const char *targ_name = btf_type_name(kptr_field->kptr.btf, kptr_field->kptr.btf_id); in map_kptr_match_type()
5775 reg_name = btf_type_name(reg->btf, reg->btf_id); in map_kptr_match_type()
5810 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in map_kptr_match_type()
5811 kptr_field->kptr.btf, kptr_field->kptr.btf_id, in map_kptr_match_type()
5860 static bool rcu_protected_object(const struct btf *btf, u32 btf_id) in BTF_ID()
5864 return btf_id_set_contains(&rcu_protected_types, btf_id); in BTF_ID()
5875 kptr_field->kptr.btf_id); in kptr_pointee_btf_record()
5885 (field->type == BPF_KPTR_REF && rcu_protected_object(kptr->btf, kptr->btf_id)); in rcu_safe_kptr()
5917 t = btf_type_by_id(field->kptr.btf, field->kptr.btf_id); in mark_uptr_ld_reg()
5969 kptr_field->kptr.btf, kptr_field->kptr.btf_id, in check_map_kptr_access()
7083 const char *field_name, u32 btf_id) in type_is_rcu() argument
7090 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu"); in type_is_rcu()
7095 const char *field_name, u32 btf_id) in type_is_rcu_or_null() argument
7101 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu_or_null"); in type_is_rcu_or_null()
7106 const char *field_name, u32 btf_id) in type_is_trusted() argument
7113 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_trusted"); in type_is_trusted()
7118 const char *field_name, u32 btf_id) in type_is_trusted_or_null() argument
7123 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, in type_is_trusted_or_null()
7134 const struct btf_type *t = btf_type_by_id(reg->btf, reg->btf_id); in check_ptr_to_btf_access()
7138 u32 btf_id = 0; in check_ptr_to_btf_access() local
7205 ret = btf_struct_access(&env->log, reg, off, size, atype, &btf_id, &flag, &field_name); in check_ptr_to_btf_access()
7233 if (type_is_trusted(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7235 } else if (type_is_trusted_or_null(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7238 if (type_is_rcu(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7242 type_is_rcu_or_null(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7247 if (type_is_rcu_or_null(env, reg, field_name, btf_id) && in check_ptr_to_btf_access()
7272 ret = mark_btf_ld_reg(env, regs, value_regno, ret, reg->btf, btf_id, flag); in check_ptr_to_btf_access()
7292 u32 btf_id; in check_ptr_to_map_access() local
7333 ret = btf_struct_access(&env->log, &map_reg, off, size, atype, &btf_id, &flag, NULL); in check_ptr_to_map_access()
7338 ret = mark_btf_ld_reg(env, regs, value_regno, ret, btf_vmlinux, btf_id, flag); in check_ptr_to_map_access()
7602 regs[value_regno].btf_id = info.btf_id; in check_mem_access()
8738 int spi, err, i, nr_slots, btf_id; in process_iter_arg() local
8751 btf_id = btf_check_iter_arg(meta->btf, meta->func_proto, regno - 1); in process_iter_arg()
8752 if (btf_id < 0) { in process_iter_arg()
8756 t = btf_type_by_id(meta->btf, btf_id); in process_iter_arg()
8763 iter_type_str(meta->btf, btf_id), regno - 1); in process_iter_arg()
8774 err = mark_stack_slots_iter(env, meta, reg, insn_idx, meta->btf, btf_id, nr_slots); in process_iter_arg()
8781 err = is_iter_reg_valid_init(env, reg, meta->btf, btf_id, nr_slots); in process_iter_arg()
8787 iter_type_str(meta->btf, btf_id), regno - 1); in process_iter_arg()
9092 u32 *btf_id; member
9114 .btf_id = &btf_sock_ids[BTF_SOCK_TYPE_SOCK_COMMON],
9294 if (!compatible->btf_id) { in check_reg_type()
9298 arg_btf_id = compatible->btf_id; in check_reg_type()
9312 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in check_reg_type()
9316 regno, btf_type_name(reg->btf, reg->btf_id), in check_reg_type()
9790 if (!reg->btf_id) { in check_func_arg()
9795 meta->ret_btf_id = reg->btf_id; in check_func_arg()
10504 err = check_reg_type(env, regno, arg->arg_type, &arg->btf_id, &meta); in btf_check_func_arg_match()
10529 u32 btf_id; in btf_check_subprog_call() local
10535 btf_id = prog->aux->func_info[subprog].type_id; in btf_check_subprog_call()
10536 if (!btf_id) in btf_check_subprog_call()
10837 callee->regs[BPF_REG_2].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_VMA]; in set_find_vma_callback_state()
10935 static bool is_rbtree_lock_required_kfunc(u32 btf_id);
11662 type = btf_type_by_id(reg->btf, reg->btf_id); in check_helper_call()
11780 regs[BPF_REG_0].btf_id = meta.ret_btf_id; in check_helper_call()
11793 ret_btf_id = meta.kptr_field->kptr.btf_id; in check_helper_call()
11815 regs[BPF_REG_0].btf_id = ret_btf_id; in check_helper_call()
12494 reg_ref_id = reg->btf_id; in process_kf_arg_ptr_to_btf_id()
12729 static bool is_bpf_list_api_kfunc(u32 btf_id) in is_bpf_list_api_kfunc() argument
12731 return btf_id == special_kfunc_list[KF_bpf_list_push_front_impl] || in is_bpf_list_api_kfunc()
12732 btf_id == special_kfunc_list[KF_bpf_list_push_back_impl] || in is_bpf_list_api_kfunc()
12733 btf_id == special_kfunc_list[KF_bpf_list_pop_front] || in is_bpf_list_api_kfunc()
12734 btf_id == special_kfunc_list[KF_bpf_list_pop_back] || in is_bpf_list_api_kfunc()
12735 btf_id == special_kfunc_list[KF_bpf_list_front] || in is_bpf_list_api_kfunc()
12736 btf_id == special_kfunc_list[KF_bpf_list_back]; in is_bpf_list_api_kfunc()
12739 static bool is_bpf_rbtree_api_kfunc(u32 btf_id) in is_bpf_rbtree_api_kfunc() argument
12741 return btf_id == special_kfunc_list[KF_bpf_rbtree_add_impl] || in is_bpf_rbtree_api_kfunc()
12742 btf_id == special_kfunc_list[KF_bpf_rbtree_remove] || in is_bpf_rbtree_api_kfunc()
12743 btf_id == special_kfunc_list[KF_bpf_rbtree_first] || in is_bpf_rbtree_api_kfunc()
12744 btf_id == special_kfunc_list[KF_bpf_rbtree_root] || in is_bpf_rbtree_api_kfunc()
12745 btf_id == special_kfunc_list[KF_bpf_rbtree_left] || in is_bpf_rbtree_api_kfunc()
12746 btf_id == special_kfunc_list[KF_bpf_rbtree_right]; in is_bpf_rbtree_api_kfunc()
12749 static bool is_bpf_iter_num_api_kfunc(u32 btf_id) in is_bpf_iter_num_api_kfunc() argument
12751 return btf_id == special_kfunc_list[KF_bpf_iter_num_new] || in is_bpf_iter_num_api_kfunc()
12752 btf_id == special_kfunc_list[KF_bpf_iter_num_next] || in is_bpf_iter_num_api_kfunc()
12753 btf_id == special_kfunc_list[KF_bpf_iter_num_destroy]; in is_bpf_iter_num_api_kfunc()
12756 static bool is_bpf_graph_api_kfunc(u32 btf_id) in is_bpf_graph_api_kfunc() argument
12758 return is_bpf_list_api_kfunc(btf_id) || is_bpf_rbtree_api_kfunc(btf_id) || in is_bpf_graph_api_kfunc()
12759 btf_id == special_kfunc_list[KF_bpf_refcount_acquire_impl]; in is_bpf_graph_api_kfunc()
12762 static bool is_bpf_res_spin_lock_kfunc(u32 btf_id) in is_bpf_res_spin_lock_kfunc() argument
12764 return btf_id == special_kfunc_list[KF_bpf_res_spin_lock] || in is_bpf_res_spin_lock_kfunc()
12765 btf_id == special_kfunc_list[KF_bpf_res_spin_unlock] || in is_bpf_res_spin_lock_kfunc()
12766 btf_id == special_kfunc_list[KF_bpf_res_spin_lock_irqsave] || in is_bpf_res_spin_lock_kfunc()
12767 btf_id == special_kfunc_list[KF_bpf_res_spin_unlock_irqrestore]; in is_bpf_res_spin_lock_kfunc()
12770 static bool kfunc_spin_allowed(u32 btf_id) in kfunc_spin_allowed() argument
12772 return is_bpf_graph_api_kfunc(btf_id) || is_bpf_iter_num_api_kfunc(btf_id) || in kfunc_spin_allowed()
12773 is_bpf_res_spin_lock_kfunc(btf_id); in kfunc_spin_allowed()
12776 static bool is_sync_callback_calling_kfunc(u32 btf_id) in is_sync_callback_calling_kfunc() argument
12778 return btf_id == special_kfunc_list[KF_bpf_rbtree_add_impl]; in is_sync_callback_calling_kfunc()
12781 static bool is_async_callback_calling_kfunc(u32 btf_id) in is_async_callback_calling_kfunc() argument
12783 return btf_id == special_kfunc_list[KF_bpf_wq_set_callback_impl] || in is_async_callback_calling_kfunc()
12784 is_task_work_add_kfunc(btf_id); in is_async_callback_calling_kfunc()
12793 static bool is_bpf_wq_set_callback_impl_kfunc(u32 btf_id) in is_bpf_wq_set_callback_impl_kfunc() argument
12795 return btf_id == special_kfunc_list[KF_bpf_wq_set_callback_impl]; in is_bpf_wq_set_callback_impl_kfunc()
12798 static bool is_callback_calling_kfunc(u32 btf_id) in is_callback_calling_kfunc() argument
12800 return is_sync_callback_calling_kfunc(btf_id) || in is_callback_calling_kfunc()
12801 is_async_callback_calling_kfunc(btf_id); in is_callback_calling_kfunc()
12804 static bool is_rbtree_lock_required_kfunc(u32 btf_id) in is_rbtree_lock_required_kfunc() argument
12806 return is_bpf_rbtree_api_kfunc(btf_id); in is_rbtree_lock_required_kfunc()
12969 t = btf_type_by_id(reg->btf, reg->btf_id); in __process_kf_arg_ptr_to_graph_node()
12970 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, 0, field->graph_root.btf, in __process_kf_arg_ptr_to_graph_node()
12982 meta->arg_btf_id = reg->btf_id; in __process_kf_arg_ptr_to_graph_node()
13276 meta->arg_btf_id = reg->btf_id; in check_kfunc_args()
13499 meta->arg_btf_id = reg->btf_id; in check_kfunc_args()
13702 regs[BPF_REG_0].btf_id = ret_btf_id; in check_special_kfunc()
13712 regs[BPF_REG_0].btf_id = meta->arg_btf_id; in check_special_kfunc()
13729 regs[BPF_REG_0].btf_id = meta->ret_btf_id; in check_special_kfunc()
13740 regs[BPF_REG_0].btf_id = meta->arg_constant.value; in check_special_kfunc()
14088 regs[BPF_REG_0].btf_id = ptr_type_id; in check_kfunc_call()
16981 dst_reg->btf_id = aux->btf_var.btf_id; in check_ld_imm()
17165 reg_type = reg->btf ? btf_type_by_id(reg->btf, reg->btf_id) : NULL; in check_return_code()
18934 old_reg->iter.btf_id != cur_reg->iter.btf_id || in stacksafe()
20263 aux->btf_var.btf_id = type; in __check_pseudo_btf_id()
20282 aux->btf_var.btf_id = type; in __check_pseudo_btf_id()
23224 reg->btf_id = arg->btf_id; in do_check_common()
23390 u32 btf_id, member_idx, member_off; in check_struct_ops_btf_id() local
23414 btf_id = prog->aux->attach_btf_id; in check_struct_ops_btf_id()
23415 st_ops_desc = bpf_struct_ops_find(btf, btf_id); in check_struct_ops_btf_id()
23418 btf_id); in check_struct_ops_btf_id()
23518 static int check_non_sleepable_error_inject(u32 btf_id) in BTF_ID()
23520 return btf_id_set_contains(&btf_non_sleepable_error_inject, btf_id); in BTF_ID()
23526 u32 btf_id, in bpf_check_attach_target() argument
23542 if (!btf_id) { in bpf_check_attach_target()
23552 t = btf_type_by_id(btf, btf_id); in bpf_check_attach_target()
23554 bpf_log(log, "attach_btf_id %u is invalid\n", btf_id); in bpf_check_attach_target()
23559 bpf_log(log, "attach_btf_id %u doesn't have a name\n", btf_id); in bpf_check_attach_target()
23574 if (aux->func_info[i].type_id == btf_id) { in bpf_check_attach_target()
23678 btf_id); in bpf_check_attach_target()
23683 btf_id, tname); in bpf_check_attach_target()
23724 btf_id); in bpf_check_attach_target()
23745 btf_id); in bpf_check_attach_target()
23799 if (!check_non_sleepable_error_inject(btf_id) && in bpf_check_attach_target()
23806 u32 *flags = btf_kfunc_is_modify_return(btf, btf_id, in bpf_check_attach_target()
23817 if (bpf_lsm_is_sleepable_hook(btf_id)) in bpf_check_attach_target()
23835 if (btf_kfunc_is_modify_return(btf, btf_id, prog) || in bpf_check_attach_target()
23924 u32 btf_id = prog->aux->attach_btf_id; in check_attach_btf_id() local
23950 ret = bpf_check_attach_target(&env->log, prog, tgt_prog, btf_id, &tgt_info); in check_attach_btf_id()
23985 btf_id_set_contains(&btf_id_deny, btf_id)) { in check_attach_btf_id()
23991 btf_id_set_contains(&noreturn_deny, btf_id)) { in check_attach_btf_id()
23997 key = bpf_trampoline_compute_key(tgt_prog, prog->aux->attach_btf, btf_id); in check_attach_btf_id()