Lines Matching refs:log
294 void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt, in bpf_verifier_vlog() argument
299 n = vscnprintf(log->kbuf, BPF_VERIFIER_TMP_LOG_SIZE, fmt, args); in bpf_verifier_vlog()
304 if (log->level == BPF_LOG_KERNEL) { in bpf_verifier_vlog()
305 bool newline = n > 0 && log->kbuf[n - 1] == '\n'; in bpf_verifier_vlog()
307 pr_err("BPF: %s%s", log->kbuf, newline ? "" : "\n"); in bpf_verifier_vlog()
311 n = min(log->len_total - log->len_used - 1, n); in bpf_verifier_vlog()
312 log->kbuf[n] = '\0'; in bpf_verifier_vlog()
313 if (!copy_to_user(log->ubuf + log->len_used, log->kbuf, n + 1)) in bpf_verifier_vlog()
314 log->len_used += n; in bpf_verifier_vlog()
316 log->ubuf = NULL; in bpf_verifier_vlog()
319 static void bpf_vlog_reset(struct bpf_verifier_log *log, u32 new_pos) in bpf_vlog_reset() argument
323 if (!bpf_verifier_log_needed(log)) in bpf_vlog_reset()
326 log->len_used = new_pos; in bpf_vlog_reset()
327 if (put_user(zero, log->ubuf + new_pos)) in bpf_vlog_reset()
328 log->ubuf = NULL; in bpf_vlog_reset()
340 if (!bpf_verifier_log_needed(&env->log)) in bpf_verifier_log_write()
344 bpf_verifier_vlog(&env->log, fmt, args); in bpf_verifier_log_write()
354 if (!bpf_verifier_log_needed(&env->log)) in verbose()
358 bpf_verifier_vlog(&env->log, fmt, args); in verbose()
362 __printf(2, 3) void bpf_log(struct bpf_verifier_log *log, in bpf_log() argument
367 if (!bpf_verifier_log_needed(log)) in bpf_log()
371 bpf_verifier_vlog(log, fmt, args); in bpf_log()
390 if (!bpf_verifier_log_needed(&env->log)) in verbose_linfo()
401 bpf_verifier_vlog(&env->log, prefix_fmt, args); in verbose_linfo()
994 if (env->prev_log_len && env->prev_log_len == env->log.len_used) { in print_insn_state()
996 bpf_vlog_reset(&env->log, env->prev_log_len - 1); in print_insn_state()
1275 bpf_vlog_reset(&env->log, head->log_pos); in pop_stack()
1303 elem->log_pos = env->log.len_used; in push_stack()
1807 elem->log_pos = env->log.len_used; in push_async_cb()
2136 err = btf_distill_func_proto(&env->log, desc_btf, in add_kfunc_call()
2226 if (env->log.level & BPF_LOG_LEVEL2) in add_subprog_and_kfunc()
2607 if (env->log.level & BPF_LOG_LEVEL2) { in backtrack_insn()
3005 if (env->log.level & BPF_LOG_LEVEL2) in __mark_chain_precision()
3121 if (env->log.level & BPF_LOG_LEVEL2) { in __mark_chain_precision()
3980 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in map_kptr_match_type()
4217 .log = &env->log, in check_ctx_access()
4804 ret = env->ops->btf_struct_access(&env->log, reg->btf, t, in check_ptr_to_btf_access()
4812 ret = btf_struct_access(&env->log, reg->btf, t, off, size, in check_ptr_to_btf_access()
4877 ret = btf_struct_access(&env->log, btf_vmlinux, t, off, size, atype, &btf_id, &flag); in check_ptr_to_map_access()
6073 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, in check_reg_type()
6947 if (env->log.level & BPF_LOG_LEVEL) in __check_func_call()
7030 if (env->log.level & BPF_LOG_LEVEL) { in __check_func_call()
7293 if (env->log.level & BPF_LOG_LEVEL) { in prepare_func_exit()
10508 if (env->log.level & BPF_LOG_LEVEL) in check_cond_jmp_op()
10522 if (env->log.level & BPF_LOG_LEVEL) in check_cond_jmp_op()
10607 if (env->log.level & BPF_LOG_LEVEL) in check_cond_jmp_op()
11550 .log = &env->log, in check_core_relo()
12150 if (env->log.level & BPF_LOG_LEVEL2) in propagate_precision()
12165 if (env->log.level & BPF_LOG_LEVEL2) in propagate_precision()
12457 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2); in do_check()
12492 if (env->log.level & BPF_LOG_LEVEL) { in do_check()
12510 if (env->log.level & BPF_LOG_LEVEL2 && do_print_state) { in do_check()
12519 if (env->log.level & BPF_LOG_LEVEL) { in do_check()
12530 env->prev_log_len = env->log.len_used; in do_check()
12533 env->prev_insn_print_len = env->log.len_used - env->prev_log_len; in do_check()
12534 env->prev_log_len = env->log.len_used; in do_check()
14900 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2); in do_check_common()
14974 bpf_vlog_reset(&env->log, 0); in do_check_common()
15012 } else if (env->log.level & BPF_LOG_LEVEL) { in do_check_subprogs()
15037 if (env->log.level & BPF_LOG_STATS) { in print_verification_stats()
15141 int bpf_check_attach_target(struct bpf_verifier_log *log, in bpf_check_attach_target() argument
15157 bpf_log(log, "Tracing programs must provide btf_id\n"); in bpf_check_attach_target()
15162 bpf_log(log, in bpf_check_attach_target()
15168 bpf_log(log, "attach_btf_id %u is invalid\n", btf_id); in bpf_check_attach_target()
15173 bpf_log(log, "attach_btf_id %u doesn't have a name\n", btf_id); in bpf_check_attach_target()
15185 bpf_log(log, "Subprog %s doesn't exist\n", tname); in bpf_check_attach_target()
15191 bpf_log(log, in bpf_check_attach_target()
15196 bpf_log(log, in bpf_check_attach_target()
15202 bpf_log(log, "Can attach to only JITed progs\n"); in bpf_check_attach_target()
15210 bpf_log(log, "Cannot recursively attach\n"); in bpf_check_attach_target()
15232 bpf_log(log, "Cannot extend fentry/fexit\n"); in bpf_check_attach_target()
15237 bpf_log(log, "Cannot replace kernel functions\n"); in bpf_check_attach_target()
15245 bpf_log(log, in bpf_check_attach_target()
15250 bpf_log(log, "attach_btf_id %u is not a typedef\n", in bpf_check_attach_target()
15255 bpf_log(log, "attach_btf_id %u points to wrong type name %s\n", in bpf_check_attach_target()
15272 bpf_log(log, "attach_btf_id %u is not a function\n", in bpf_check_attach_target()
15279 ret = btf_distill_func_proto(log, btf, t, tname, &tgt_info->fmodel); in bpf_check_attach_target()
15293 bpf_log(log, "attach_btf_id %u is not a function\n", in bpf_check_attach_target()
15298 btf_check_type_match(log, prog, btf, t)) in bpf_check_attach_target()
15312 ret = btf_distill_func_proto(log, btf, t, tname, &tgt_info->fmodel); in bpf_check_attach_target()
15324 bpf_log(log, in bpf_check_attach_target()
15353 bpf_log(log, "%s is not sleepable\n", tname); in bpf_check_attach_target()
15358 bpf_log(log, "can't modify return codes of BPF programs\n"); in bpf_check_attach_target()
15363 bpf_log(log, "%s() is not modifiable\n", tname); in bpf_check_attach_target()
15423 ret = bpf_check_attach_target(&env->log, prog, tgt_prog, btf_id, &tgt_info); in BTF_SET_START()
15455 ret = bpf_lsm_verify_prog(&env->log, prog); in BTF_SET_START()
15490 struct bpf_verifier_log *log; in bpf_check() local
15504 log = &env->log; in bpf_check()
15529 log->level = attr->log_level; in bpf_check()
15530 log->ubuf = (char __user *) (unsigned long) attr->log_buf; in bpf_check()
15531 log->len_total = attr->log_size; in bpf_check()
15534 if (!bpf_verifier_log_attr_valid(log)) { in bpf_check()
15653 if (log->level && bpf_verifier_log_full(log)) in bpf_check()
15655 if (log->level && !log->ubuf) { in bpf_check()