Lines Matching refs:log
286 struct bpf_verifier_log log; member
1367 __printf(2, 3) static void __btf_verifier_log(struct bpf_verifier_log *log, in __btf_verifier_log() argument
1373 bpf_verifier_vlog(log, fmt, args); in __btf_verifier_log()
1380 struct bpf_verifier_log *log = &env->log; in btf_verifier_log() local
1383 if (!bpf_verifier_log_needed(log)) in btf_verifier_log()
1387 bpf_verifier_vlog(log, fmt, args); in btf_verifier_log()
1396 struct bpf_verifier_log *log = &env->log; in __btf_verifier_log_type() local
1400 if (!bpf_verifier_log_needed(log)) in __btf_verifier_log_type()
1403 if (log->level == BPF_LOG_KERNEL) { in __btf_verifier_log_type()
1416 __btf_verifier_log(log, "[%u] %s %s%s", in __btf_verifier_log_type()
1426 __btf_verifier_log(log, " "); in __btf_verifier_log_type()
1428 bpf_verifier_vlog(log, fmt, args); in __btf_verifier_log_type()
1432 __btf_verifier_log(log, "\n"); in __btf_verifier_log_type()
1446 struct bpf_verifier_log *log = &env->log; in btf_verifier_log_member() local
1450 if (!bpf_verifier_log_needed(log)) in btf_verifier_log_member()
1453 if (log->level == BPF_LOG_KERNEL) { in btf_verifier_log_member()
1472 __btf_verifier_log(log, in btf_verifier_log_member()
1479 __btf_verifier_log(log, "\t%s type_id=%u bits_offset=%u", in btf_verifier_log_member()
1484 __btf_verifier_log(log, " "); in btf_verifier_log_member()
1486 bpf_verifier_vlog(log, fmt, args); in btf_verifier_log_member()
1490 __btf_verifier_log(log, "\n"); in btf_verifier_log_member()
1499 struct bpf_verifier_log *log = &env->log; in btf_verifier_log_vsi() local
1502 if (!bpf_verifier_log_needed(log)) in btf_verifier_log_vsi()
1504 if (log->level == BPF_LOG_KERNEL && !fmt) in btf_verifier_log_vsi()
1509 __btf_verifier_log(log, "\t type_id=%u offset=%u size=%u", in btf_verifier_log_vsi()
1512 __btf_verifier_log(log, " "); in btf_verifier_log_vsi()
1514 bpf_verifier_vlog(log, fmt, args); in btf_verifier_log_vsi()
1518 __btf_verifier_log(log, "\n"); in btf_verifier_log_vsi()
1524 struct bpf_verifier_log *log = &env->log; in btf_verifier_log_hdr() local
1528 if (!bpf_verifier_log_needed(log)) in btf_verifier_log_hdr()
1531 if (log->level == BPF_LOG_KERNEL) in btf_verifier_log_hdr()
1534 __btf_verifier_log(log, "magic: 0x%x\n", hdr->magic); in btf_verifier_log_hdr()
1535 __btf_verifier_log(log, "version: %u\n", hdr->version); in btf_verifier_log_hdr()
1536 __btf_verifier_log(log, "flags: 0x%x\n", hdr->flags); in btf_verifier_log_hdr()
1537 __btf_verifier_log(log, "hdr_len: %u\n", hdr->hdr_len); in btf_verifier_log_hdr()
1538 __btf_verifier_log(log, "type_off: %u\n", hdr->type_off); in btf_verifier_log_hdr()
1539 __btf_verifier_log(log, "type_len: %u\n", hdr->type_len); in btf_verifier_log_hdr()
1540 __btf_verifier_log(log, "str_off: %u\n", hdr->str_off); in btf_verifier_log_hdr()
1541 __btf_verifier_log(log, "str_len: %u\n", hdr->str_len); in btf_verifier_log_hdr()
1542 __btf_verifier_log(log, "btf_total_size: %u\n", btf_data_size); in btf_verifier_log_hdr()
3733 if (env->log.level == BPF_LOG_KERNEL) in btf_enum_check_meta()
3841 if (env->log.level == BPF_LOG_KERNEL) in btf_enum64_check_meta()
4988 struct bpf_verifier_log *log; in btf_parse() local
5000 log = &env->log; in btf_parse()
5005 log->level = log_level; in btf_parse()
5006 log->ubuf = log_ubuf; in btf_parse()
5007 log->len_total = log_size; in btf_parse()
5010 if (!bpf_verifier_log_attr_valid(log)) { in btf_parse()
5055 if (log->level && bpf_verifier_log_full(log)) { in btf_parse()
5106 btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, in btf_get_prog_ctx_type() argument
5117 bpf_log(log, "btf_vmlinux is malformed\n"); in btf_get_prog_ctx_type()
5133 bpf_log(log, "arg#%d struct doesn't have a name\n", arg); in btf_get_prog_ctx_type()
5149 bpf_log(log, "Please fix kernel include/linux/bpf_types.h\n"); in btf_get_prog_ctx_type()
5172 static int btf_translate_to_vmlinux(struct bpf_verifier_log *log, in btf_translate_to_vmlinux() argument
5180 prog_ctx_type = btf_get_prog_ctx_type(log, btf, t, prog_type, arg); in btf_translate_to_vmlinux()
5193 struct bpf_verifier_log *log; in BTF_ID() local
5201 log = &env->log; in BTF_ID()
5202 log->level = BPF_LOG_KERNEL; in BTF_ID()
5237 bpf_struct_ops_init(btf, log); in BTF_ID()
5262 struct bpf_verifier_log *log; in btf_parse_module() local
5276 log = &env->log; in btf_parse_module()
5277 log->level = BPF_LOG_KERNEL; in btf_parse_module()
5388 struct bpf_verifier_log *log = info->log; in btf_ctx_access() local
5395 bpf_log(log, "func '%s' offset %d is not multiple of 8\n", in btf_ctx_access()
5412 bpf_log(log, "func '%s' doesn't have %d-th argument\n", in btf_ctx_access()
5448 bpf_log(log, in btf_ctx_access()
5455 bpf_log(log, "func '%s' doesn't have %d-th argument\n", in btf_ctx_access()
5473 bpf_log(log, in btf_ctx_access()
5511 bpf_log(log,"invalid btf_id for context argument offset %u\n", off); in btf_ctx_access()
5531 ret = btf_translate_to_vmlinux(log, btf, t, tgt_type, arg); in btf_ctx_access()
5559 bpf_log(log, in btf_ctx_access()
5564 bpf_log(log, "func '%s' arg%d has btf_id %d type %s '%s'\n", in btf_ctx_access()
5577 static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf, in btf_struct_walk() argument
5590 bpf_log(log, "Type '%s' is not a struct\n", tname); in btf_struct_walk()
5630 bpf_log(log, "access beyond struct %s at off %u size %u\n", in btf_struct_walk()
5686 bpf_log(log, "field %s doesn't have size\n", mname); in btf_struct_walk()
5773 bpf_log(log, in btf_struct_walk()
5806 bpf_log(log, in btf_struct_walk()
5814 bpf_log(log, "struct %s doesn't have field at offset %d\n", tname, off); in btf_struct_walk()
5818 int btf_struct_access(struct bpf_verifier_log *log, const struct btf *btf, in btf_struct_access() argument
5828 err = btf_struct_walk(log, btf, t, off, size, &id, &tmp_flag); in btf_struct_access()
5876 bool btf_struct_ids_match(struct bpf_verifier_log *log, in btf_struct_ids_match() argument
5898 err = btf_struct_walk(log, btf, type, off, 1, &id, &flag); in btf_struct_ids_match()
5938 int btf_distill_func_proto(struct bpf_verifier_log *log, in btf_distill_func_proto() argument
5964 bpf_log(log, in btf_distill_func_proto()
5971 bpf_log(log, in btf_distill_func_proto()
5980 bpf_log(log, in btf_distill_func_proto()
5989 bpf_log(log, in btf_distill_func_proto()
5995 bpf_log(log, in btf_distill_func_proto()
6015 static int btf_check_func_type_match(struct bpf_verifier_log *log, in btf_check_func_type_match() argument
6027 bpf_log(log, "%s() is not a global function\n", fn1); in btf_check_func_type_match()
6031 bpf_log(log, "%s() is not a global function\n", fn2); in btf_check_func_type_match()
6048 bpf_log(log, "%s() has %d args while %s() has %d args\n", in btf_check_func_type_match()
6056 bpf_log(log, in btf_check_func_type_match()
6068 bpf_log(log, "arg%d in %s() is %s while %s() has %s\n", in btf_check_func_type_match()
6074 bpf_log(log, in btf_check_func_type_match()
6088 bpf_log(log, in btf_check_func_type_match()
6096 bpf_log(log, in btf_check_func_type_match()
6102 bpf_log(log, in btf_check_func_type_match()
6116 bpf_log(log, in btf_check_func_type_match()
6126 int btf_check_type_match(struct bpf_verifier_log *log, const struct bpf_prog *prog, in btf_check_type_match() argument
6134 bpf_log(log, "Program extension requires BTF\n"); in btf_check_type_match()
6146 return btf_check_func_type_match(log, btf1, t1, btf2, t2); in btf_check_type_match()
6158 static bool __btf_type_is_scalar_struct(struct bpf_verifier_log *log, in __btf_type_is_scalar_struct() argument
6175 bpf_log(log, "max struct nesting depth exceeded\n"); in __btf_type_is_scalar_struct()
6178 if (!__btf_type_is_scalar_struct(log, btf, member_type, rec + 1)) in __btf_type_is_scalar_struct()
6258 struct bpf_verifier_log *log = &env->log; in btf_check_func_arg_match() local
6271 bpf_log(log, "BTF of func_id %u doesn't point to KIND_FUNC\n", in btf_check_func_arg_match()
6279 bpf_log(log, "Invalid BTF of func %s\n", func_name); in btf_check_func_arg_match()
6285 bpf_log(log, "Function %s has %d > %d args\n", func_name, nargs, in btf_check_func_arg_match()
6325 bpf_log(log, "2 or more rdonly/rdwr_buf_size parameters for kfunc"); in btf_check_func_arg_match()
6330 bpf_log(log, "R%d is not a const\n", regno); in btf_check_func_arg_match()
6343 bpf_log(log, "R%d is not a scalar\n", regno); in btf_check_func_arg_match()
6348 bpf_log(log, "Unrecognized arg#%d type %s\n", in btf_check_func_arg_match()
6364 bpf_log(log, "R%d must be referenced\n", regno); in btf_check_func_arg_match()
6381 bpf_log(log, "verifier internal error: more than one arg with ref_obj_id R%d %u %u\n", in btf_check_func_arg_match()
6394 bpf_log(log, "arg#0 expected pointer to map value\n"); in btf_check_func_arg_match()
6403 bpf_log(log, "arg#0 must have constant offset\n"); in btf_check_func_arg_match()
6409 bpf_log(log, "arg#0 no referenced kptr at map value offset=%llu\n", in btf_check_func_arg_match()
6415 bpf_log(log, "arg#0 BTF type must be a double pointer\n"); in btf_check_func_arg_match()
6423 bpf_log(log, "kernel function %s args#%d pointer type %s %s is not supported\n", in btf_check_func_arg_match()
6427 if (!btf_struct_ids_match(log, btf, ref_id, 0, off_desc->kptr.btf, in btf_check_func_arg_match()
6429 bpf_log(log, "kernel function %s args#%d expected pointer to %s %s\n", in btf_check_func_arg_match()
6434 } else if (btf_get_prog_ctx_type(log, btf, t, prog_type, i)) { in btf_check_func_arg_match()
6439 bpf_log(log, in btf_check_func_arg_match()
6452 bpf_log(log, "kernel function %s args#%d pointer type %s %s is not supported\n", in btf_check_func_arg_match()
6470 if (!btf_struct_ids_match(log, reg_btf, reg_ref_id, in btf_check_func_arg_match()
6473 …bpf_log(log, "kernel function %s args#%d expected pointer to %s %s but R%d has a pointer to %s %s\… in btf_check_func_arg_match()
6498 !__btf_type_is_scalar_struct(log, btf, ref_t, 0) && in btf_check_func_arg_match()
6501 bpf_log(log, in btf_check_func_arg_match()
6509 bpf_log(log, "arg#%d pointer type %s %s not to stack\n", in btf_check_func_arg_match()
6516 bpf_log(log, in btf_check_func_arg_match()
6525 bpf_log(log, in btf_check_func_arg_match()
6538 bpf_log(log, "arg#%d arg#%d memory, len pair leads to invalid memory access\n", in btf_check_func_arg_match()
6549 bpf_log(log, in btf_check_func_arg_match()
6559 bpf_log(log, "reg type unsupported for arg#%d %sfunction %s#%d\n", i, in btf_check_func_arg_match()
6573 bpf_log(log, "release kernel function %s expects refcounted PTR_TO_BTF_ID\n", in btf_check_func_arg_match()
6579 bpf_log(log, "kernel function %s is sleepable but the program is not\n", in btf_check_func_arg_match()
6690 struct bpf_verifier_log *log = &env->log; in btf_prepare_func_args() local
6701 bpf_log(log, "Verifier bug\n"); in btf_prepare_func_args()
6707 bpf_log(log, "Global functions need valid BTF\n"); in btf_prepare_func_args()
6716 bpf_log(log, "BTF of func#%d doesn't point to KIND_FUNC\n", in btf_prepare_func_args()
6722 if (log->level & BPF_LOG_LEVEL) in btf_prepare_func_args()
6723 bpf_log(log, "Validating %s() func#%d...\n", in btf_prepare_func_args()
6727 bpf_log(log, "Verifier bug in function %s()\n", tname); in btf_prepare_func_args()
6735 bpf_log(log, "Invalid type of function %s()\n", tname); in btf_prepare_func_args()
6741 bpf_log(log, "Global function %s() with %d > %d args. Buggy compiler.\n", in btf_prepare_func_args()
6750 bpf_log(log, in btf_prepare_func_args()
6769 if (btf_get_prog_ctx_type(log, btf, t, prog_type, i)) { in btf_prepare_func_args()
6778 bpf_log(log, in btf_prepare_func_args()
6790 bpf_log(log, "Arg#%d type %s in %s() is not supported yet.\n", in btf_prepare_func_args()
7725 static void __print_cand_cache(struct bpf_verifier_log *log, in __print_cand_cache() argument
7736 bpf_log(log, "[%d]%s(", i, cc->name); in __print_cand_cache()
7738 bpf_log(log, "%d", cc->cands[j].id); in __print_cand_cache()
7740 bpf_log(log, " "); in __print_cand_cache()
7742 bpf_log(log, "), "); in __print_cand_cache()
7746 static void print_cand_cache(struct bpf_verifier_log *log) in print_cand_cache() argument
7749 bpf_log(log, "vmlinux_cand_cache:"); in print_cand_cache()
7750 __print_cand_cache(log, vmlinux_cand_cache, VMLINUX_CAND_CACHE_SIZE); in print_cand_cache()
7751 bpf_log(log, "\nmodule_cand_cache:"); in print_cand_cache()
7752 __print_cand_cache(log, module_cand_cache, MODULE_CAND_CACHE_SIZE); in print_cand_cache()
7753 bpf_log(log, "\n"); in print_cand_cache()
8008 bpf_log(ctx->log, "target candidate search failed for %d\n", in bpf_core_apply()
8021 bpf_log(ctx->log, in bpf_core_apply()
8035 err = bpf_core_calc_relo_insn((void *)ctx->log, relo, relo_idx, ctx->btf, &cands, specs, in bpf_core_apply()
8040 err = bpf_core_patch_insn((void *)ctx->log, insn, relo->insn_off / 8, relo, relo_idx, in bpf_core_apply()
8048 if (ctx->log->level & BPF_LOG_LEVEL2) in bpf_core_apply()
8049 print_cand_cache(ctx->log); in bpf_core_apply()