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);
1030 struct btf *btf, u32 btf_id, int nr_slots) in mark_stack_slots_iter() argument
1058 st->iter.btf_id = btf_id; in mark_stack_slots_iter()
1130 struct btf *btf, u32 btf_id, int nr_slots) in is_iter_reg_valid_init() argument
1150 if (st->iter.btf != btf || st->iter.btf_id != btf_id) in is_iter_reg_valid_init()
2259 regs[regno].btf_id = ds_head->value_btf_id; in mark_reg_graph_node()
2841 struct btf *btf, u32 btf_id, in mark_btf_ld_reg() argument
2852 regs[regno].btf_id = btf_id; in mark_btf_ld_reg()
5839 const char *targ_name = btf_type_name(kptr_field->kptr.btf, kptr_field->kptr.btf_id); in map_kptr_match_type()
5859 reg_name = btf_type_name(reg->btf, reg->btf_id); in map_kptr_match_type()
5894 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in map_kptr_match_type()
5895 kptr_field->kptr.btf, kptr_field->kptr.btf_id, in map_kptr_match_type()
5944 static bool rcu_protected_object(const struct btf *btf, u32 btf_id) in BTF_ID()
5948 return btf_id_set_contains(&rcu_protected_types, btf_id); in BTF_ID()
5959 kptr_field->kptr.btf_id); in kptr_pointee_btf_record()
5969 (field->type == BPF_KPTR_REF && rcu_protected_object(kptr->btf, kptr->btf_id)); in rcu_safe_kptr()
6001 t = btf_type_by_id(field->kptr.btf, field->kptr.btf_id); in mark_uptr_ld_reg()
6053 kptr_field->kptr.btf, kptr_field->kptr.btf_id, in check_map_kptr_access()
7167 const char *field_name, u32 btf_id) in type_is_rcu() argument
7174 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu"); in type_is_rcu()
7179 const char *field_name, u32 btf_id) in type_is_rcu_or_null() argument
7185 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_rcu_or_null"); in type_is_rcu_or_null()
7190 const char *field_name, u32 btf_id) in type_is_trusted() argument
7197 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, "__safe_trusted"); in type_is_trusted()
7202 const char *field_name, u32 btf_id) in type_is_trusted_or_null() argument
7207 return btf_nested_type_is_trusted(&env->log, reg, field_name, btf_id, in type_is_trusted_or_null()
7218 const struct btf_type *t = btf_type_by_id(reg->btf, reg->btf_id); in check_ptr_to_btf_access()
7222 u32 btf_id = 0; in check_ptr_to_btf_access() local
7289 ret = btf_struct_access(&env->log, reg, off, size, atype, &btf_id, &flag, &field_name); in check_ptr_to_btf_access()
7317 if (type_is_trusted(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7319 } else if (type_is_trusted_or_null(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7322 if (type_is_rcu(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7326 type_is_rcu_or_null(env, reg, field_name, btf_id)) { in check_ptr_to_btf_access()
7331 if (type_is_rcu_or_null(env, reg, field_name, btf_id) && in check_ptr_to_btf_access()
7356 ret = mark_btf_ld_reg(env, regs, value_regno, ret, reg->btf, btf_id, flag); in check_ptr_to_btf_access()
7376 u32 btf_id; in check_ptr_to_map_access() local
7417 ret = btf_struct_access(&env->log, &map_reg, off, size, atype, &btf_id, &flag, NULL); in check_ptr_to_map_access()
7422 ret = mark_btf_ld_reg(env, regs, value_regno, ret, btf_vmlinux, btf_id, flag); in check_ptr_to_map_access()
7686 regs[value_regno].btf_id = info.btf_id; in check_mem_access()
8770 int spi, err, i, nr_slots, btf_id; in process_iter_arg() local
8783 btf_id = btf_check_iter_arg(meta->btf, meta->func_proto, regno - 1); in process_iter_arg()
8784 if (btf_id < 0) { in process_iter_arg()
8788 t = btf_type_by_id(meta->btf, btf_id); in process_iter_arg()
8795 iter_type_str(meta->btf, btf_id), regno - 1); in process_iter_arg()
8806 err = mark_stack_slots_iter(env, meta, reg, insn_idx, meta->btf, btf_id, nr_slots); in process_iter_arg()
8813 err = is_iter_reg_valid_init(env, reg, meta->btf, btf_id, nr_slots); in process_iter_arg()
8819 iter_type_str(meta->btf, btf_id), regno - 1); in process_iter_arg()
9124 u32 *btf_id; member
9146 .btf_id = &btf_sock_ids[BTF_SOCK_TYPE_SOCK_COMMON],
9326 if (!compatible->btf_id) { in check_reg_type()
9330 arg_btf_id = compatible->btf_id; in check_reg_type()
9344 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in check_reg_type()
9348 regno, btf_type_name(reg->btf, reg->btf_id), in check_reg_type()
9822 if (!reg->btf_id) { in check_func_arg()
9827 meta->ret_btf_id = reg->btf_id; in check_func_arg()
10534 err = check_reg_type(env, regno, arg->arg_type, &arg->btf_id, &meta); in btf_check_func_arg_match()
10559 u32 btf_id; in btf_check_subprog_call() local
10565 btf_id = prog->aux->func_info[subprog].type_id; in btf_check_subprog_call()
10566 if (!btf_id) in btf_check_subprog_call()
10864 callee->regs[BPF_REG_2].btf_id = btf_tracing_ids[BTF_TRACING_TYPE_VMA]; in set_find_vma_callback_state()
10932 static bool is_rbtree_lock_required_kfunc(u32 btf_id);
11659 type = btf_type_by_id(reg->btf, reg->btf_id); in check_helper_call()
11777 regs[BPF_REG_0].btf_id = meta.ret_btf_id; in check_helper_call()
11790 ret_btf_id = meta.kptr_field->kptr.btf_id; in check_helper_call()
11812 regs[BPF_REG_0].btf_id = ret_btf_id; in check_helper_call()
12465 reg_ref_id = reg->btf_id; in process_kf_arg_ptr_to_btf_id()
12700 static bool is_bpf_list_api_kfunc(u32 btf_id) in is_bpf_list_api_kfunc() argument
12702 return btf_id == special_kfunc_list[KF_bpf_list_push_front_impl] || in is_bpf_list_api_kfunc()
12703 btf_id == special_kfunc_list[KF_bpf_list_push_back_impl] || in is_bpf_list_api_kfunc()
12704 btf_id == special_kfunc_list[KF_bpf_list_pop_front] || in is_bpf_list_api_kfunc()
12705 btf_id == special_kfunc_list[KF_bpf_list_pop_back] || in is_bpf_list_api_kfunc()
12706 btf_id == special_kfunc_list[KF_bpf_list_front] || in is_bpf_list_api_kfunc()
12707 btf_id == special_kfunc_list[KF_bpf_list_back]; in is_bpf_list_api_kfunc()
12710 static bool is_bpf_rbtree_api_kfunc(u32 btf_id) in is_bpf_rbtree_api_kfunc() argument
12712 return btf_id == special_kfunc_list[KF_bpf_rbtree_add_impl] || in is_bpf_rbtree_api_kfunc()
12713 btf_id == special_kfunc_list[KF_bpf_rbtree_remove] || in is_bpf_rbtree_api_kfunc()
12714 btf_id == special_kfunc_list[KF_bpf_rbtree_first] || in is_bpf_rbtree_api_kfunc()
12715 btf_id == special_kfunc_list[KF_bpf_rbtree_root] || in is_bpf_rbtree_api_kfunc()
12716 btf_id == special_kfunc_list[KF_bpf_rbtree_left] || in is_bpf_rbtree_api_kfunc()
12717 btf_id == special_kfunc_list[KF_bpf_rbtree_right]; in is_bpf_rbtree_api_kfunc()
12720 static bool is_bpf_iter_num_api_kfunc(u32 btf_id) in is_bpf_iter_num_api_kfunc() argument
12722 return btf_id == special_kfunc_list[KF_bpf_iter_num_new] || in is_bpf_iter_num_api_kfunc()
12723 btf_id == special_kfunc_list[KF_bpf_iter_num_next] || in is_bpf_iter_num_api_kfunc()
12724 btf_id == special_kfunc_list[KF_bpf_iter_num_destroy]; in is_bpf_iter_num_api_kfunc()
12727 static bool is_bpf_graph_api_kfunc(u32 btf_id) in is_bpf_graph_api_kfunc() argument
12729 return is_bpf_list_api_kfunc(btf_id) || is_bpf_rbtree_api_kfunc(btf_id) || in is_bpf_graph_api_kfunc()
12730 btf_id == special_kfunc_list[KF_bpf_refcount_acquire_impl]; in is_bpf_graph_api_kfunc()
12733 static bool is_bpf_res_spin_lock_kfunc(u32 btf_id) in is_bpf_res_spin_lock_kfunc() argument
12735 return btf_id == special_kfunc_list[KF_bpf_res_spin_lock] || in is_bpf_res_spin_lock_kfunc()
12736 btf_id == special_kfunc_list[KF_bpf_res_spin_unlock] || in is_bpf_res_spin_lock_kfunc()
12737 btf_id == special_kfunc_list[KF_bpf_res_spin_lock_irqsave] || in is_bpf_res_spin_lock_kfunc()
12738 btf_id == special_kfunc_list[KF_bpf_res_spin_unlock_irqrestore]; in is_bpf_res_spin_lock_kfunc()
12741 static bool kfunc_spin_allowed(u32 btf_id) in kfunc_spin_allowed() argument
12743 return is_bpf_graph_api_kfunc(btf_id) || is_bpf_iter_num_api_kfunc(btf_id) || in kfunc_spin_allowed()
12744 is_bpf_res_spin_lock_kfunc(btf_id); in kfunc_spin_allowed()
12747 static bool is_sync_callback_calling_kfunc(u32 btf_id) in is_sync_callback_calling_kfunc() argument
12749 return btf_id == special_kfunc_list[KF_bpf_rbtree_add_impl]; in is_sync_callback_calling_kfunc()
12752 static bool is_async_callback_calling_kfunc(u32 btf_id) in is_async_callback_calling_kfunc() argument
12754 return btf_id == special_kfunc_list[KF_bpf_wq_set_callback_impl]; in is_async_callback_calling_kfunc()
12763 static bool is_bpf_wq_set_callback_impl_kfunc(u32 btf_id) in is_bpf_wq_set_callback_impl_kfunc() argument
12765 return btf_id == special_kfunc_list[KF_bpf_wq_set_callback_impl]; in is_bpf_wq_set_callback_impl_kfunc()
12768 static bool is_callback_calling_kfunc(u32 btf_id) in is_callback_calling_kfunc() argument
12770 return is_sync_callback_calling_kfunc(btf_id) || in is_callback_calling_kfunc()
12771 is_async_callback_calling_kfunc(btf_id); in is_callback_calling_kfunc()
12774 static bool is_rbtree_lock_required_kfunc(u32 btf_id) in is_rbtree_lock_required_kfunc() argument
12776 return is_bpf_rbtree_api_kfunc(btf_id); in is_rbtree_lock_required_kfunc()
12939 t = btf_type_by_id(reg->btf, reg->btf_id); in __process_kf_arg_ptr_to_graph_node()
12940 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()
12952 meta->arg_btf_id = reg->btf_id; in __process_kf_arg_ptr_to_graph_node()
13238 meta->arg_btf_id = reg->btf_id; in check_kfunc_args()
13459 meta->arg_btf_id = reg->btf_id; in check_kfunc_args()
13653 regs[BPF_REG_0].btf_id = ret_btf_id; in check_special_kfunc()
13663 regs[BPF_REG_0].btf_id = meta->arg_btf_id; in check_special_kfunc()
13680 regs[BPF_REG_0].btf_id = meta->ret_btf_id; in check_special_kfunc()
13691 regs[BPF_REG_0].btf_id = meta->arg_constant.value; in check_special_kfunc()
14021 regs[BPF_REG_0].btf_id = ptr_type_id; in check_kfunc_call()
16908 dst_reg->btf_id = aux->btf_var.btf_id; in check_ld_imm()
17092 reg_type = reg->btf ? btf_type_by_id(reg->btf, reg->btf_id) : NULL; in check_return_code()
18832 old_reg->iter.btf_id != cur_reg->iter.btf_id || in stacksafe()
20276 aux->btf_var.btf_id = type; in __check_pseudo_btf_id()
20295 aux->btf_var.btf_id = type; in __check_pseudo_btf_id()
23225 reg->btf_id = arg->btf_id; in do_check_common()
23391 u32 btf_id, member_idx, member_off; in check_struct_ops_btf_id() local
23415 btf_id = prog->aux->attach_btf_id; in check_struct_ops_btf_id()
23416 st_ops_desc = bpf_struct_ops_find(btf, btf_id); in check_struct_ops_btf_id()
23419 btf_id); in check_struct_ops_btf_id()
23519 static int check_non_sleepable_error_inject(u32 btf_id) in BTF_ID()
23521 return btf_id_set_contains(&btf_non_sleepable_error_inject, btf_id); in BTF_ID()
23527 u32 btf_id, in bpf_check_attach_target() argument
23543 if (!btf_id) { in bpf_check_attach_target()
23553 t = btf_type_by_id(btf, btf_id); in bpf_check_attach_target()
23555 bpf_log(log, "attach_btf_id %u is invalid\n", btf_id); in bpf_check_attach_target()
23560 bpf_log(log, "attach_btf_id %u doesn't have a name\n", btf_id); in bpf_check_attach_target()
23575 if (aux->func_info[i].type_id == btf_id) { in bpf_check_attach_target()
23679 btf_id); in bpf_check_attach_target()
23684 btf_id, tname); in bpf_check_attach_target()
23725 btf_id); in bpf_check_attach_target()
23746 btf_id); in bpf_check_attach_target()
23800 if (!check_non_sleepable_error_inject(btf_id) && in bpf_check_attach_target()
23807 u32 *flags = btf_kfunc_is_modify_return(btf, btf_id, in bpf_check_attach_target()
23818 if (bpf_lsm_is_sleepable_hook(btf_id)) in bpf_check_attach_target()
23836 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()