Lines Matching full:env

14 #define verbose(env, fmt, args...) bpf_verifier_log_write(env, fmt, ##args)  argument
304 __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, in bpf_verifier_log_write() argument
309 if (!bpf_verifier_log_needed(&env->log)) in bpf_verifier_log_write()
313 bpf_verifier_vlog(&env->log, fmt, args); in bpf_verifier_log_write()
333 find_linfo(const struct bpf_verifier_env *env, u32 insn_off) in find_linfo() argument
340 prog = env->prog; in find_linfo()
381 __printf(3, 4) void verbose_linfo(struct bpf_verifier_env *env, in verbose_linfo() argument
389 if (!bpf_verifier_log_needed(&env->log)) in verbose_linfo()
392 prev_linfo = env->prev_linfo; in verbose_linfo()
393 linfo = find_linfo(env, insn_off); in verbose_linfo()
413 bpf_verifier_vlog(&env->log, prefix_fmt, args); in verbose_linfo()
417 btf = env->prog->aux->btf; in verbose_linfo()
419 verbose(env, "%s", s); /* source code line */ in verbose_linfo()
425 verbose(env, " @ %s:%u\n", fname, BPF_LINE_INFO_LINE_NUM(linfo->line_col)); in verbose_linfo()
427 env->prev_linfo = linfo; in verbose_linfo()
440 const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type) in reg_type_str() argument
485 snprintf(env->tmp_str_buf, TMP_STR_BUF_LEN, "%s%s%s", in reg_type_str()
487 return env->tmp_str_buf; in reg_type_str()
542 static void print_liveness(struct bpf_verifier_env *env, in print_liveness() argument
546 verbose(env, "_"); in print_liveness()
548 verbose(env, "r"); in print_liveness()
550 verbose(env, "w"); in print_liveness()
552 verbose(env, "D"); in print_liveness()
569 static void verbose_unum(struct bpf_verifier_env *env, u64 num) in verbose_unum() argument
572 verbose(env, "%llu", num); in verbose_unum()
574 verbose(env, "%#llx", num); in verbose_unum()
577 static void verbose_snum(struct bpf_verifier_env *env, s64 num) in verbose_snum() argument
580 verbose(env, "%lld", num); in verbose_snum()
582 verbose(env, "%#llx", num); in verbose_snum()
598 static void print_scalar_ranges(struct bpf_verifier_env *env, in print_scalar_ranges() argument
642 verbose(env, "%s%s=", *sep, m1->name); in print_scalar_ranges()
653 verbose(env, "%s=", m2->name); in print_scalar_ranges()
657 verbose_snum(env, m1->val); in print_scalar_ranges()
659 verbose_unum(env, m1->val); in print_scalar_ranges()
678 #define verbose_a(fmt, ...) ({ verbose(env, "%s" fmt, sep, ##__VA_ARGS__); sep = ","; })
680 static void print_reg_state(struct bpf_verifier_env *env, in print_reg_state() argument
689 verbose(env, "P"); in print_reg_state()
691 verbose_snum(env, reg->var_off.value); in print_reg_state()
695 verbose(env, "%s", reg_type_str(env, t)); in print_reg_state()
700 verbose(env, "[%d]", reg->frameno); in print_reg_state()
702 verbose_snum(env, reg->var_off.value + reg->off); in print_reg_state()
707 verbose(env, "%s", btf_type_name(reg->btf, reg->btf_id)); in print_reg_state()
708 verbose(env, "("); in print_reg_state()
712 verbose(env, "%+d", reg->off); in print_reg_state()
726 verbose_snum(env, reg->off); in print_reg_state()
730 verbose_unum(env, reg->range); in print_reg_state()
734 verbose_unum(env, reg->mem_size); in print_reg_state()
742 verbose_snum(env, reg->var_off.value); in print_reg_state()
745 print_scalar_ranges(env, reg, &sep); in print_reg_state()
753 verbose(env, ")"); in print_reg_state()
756 void print_verifier_state(struct bpf_verifier_env *env, const struct bpf_func_state *state, in print_verifier_state() argument
763 verbose(env, " frame%d:", state->frameno); in print_verifier_state()
768 if (!print_all && !reg_scratched(env, i)) in print_verifier_state()
770 verbose(env, " R%d", i); in print_verifier_state()
771 print_liveness(env, reg->live); in print_verifier_state()
772 verbose(env, "="); in print_verifier_state()
773 print_reg_state(env, state, reg); in print_verifier_state()
782 if (!print_all && !stack_slot_scratched(env, i)) in print_verifier_state()
804 verbose(env, " fp%d", (-i - 1) * BPF_REG_SIZE); in print_verifier_state()
805 print_liveness(env, reg->live); in print_verifier_state()
806 verbose(env, "=%s", types_buf); in print_verifier_state()
807 print_reg_state(env, state, reg); in print_verifier_state()
814 verbose(env, " fp%d", (-i - 1) * BPF_REG_SIZE); in print_verifier_state()
815 print_liveness(env, reg->live); in print_verifier_state()
816 verbose(env, "=dynptr_%s(", dynptr_type_str(reg->dynptr.type)); in print_verifier_state()
823 verbose(env, ")"); in print_verifier_state()
830 verbose(env, " fp%d", (-i - 1) * BPF_REG_SIZE); in print_verifier_state()
831 print_liveness(env, reg->live); in print_verifier_state()
832 verbose(env, "=iter_%s(ref_id=%d,state=%s,depth=%u)", in print_verifier_state()
840 verbose(env, " fp%d", (-i - 1) * BPF_REG_SIZE); in print_verifier_state()
841 print_liveness(env, reg->live); in print_verifier_state()
842 verbose(env, "=%s", types_buf); in print_verifier_state()
847 verbose(env, " refs=%d", state->refs[0].id); in print_verifier_state()
850 verbose(env, ",%d", state->refs[i].id); in print_verifier_state()
853 verbose(env, " cb"); in print_verifier_state()
855 verbose(env, " async_cb"); in print_verifier_state()
856 verbose(env, "\n"); in print_verifier_state()
858 mark_verifier_state_clean(env); in print_verifier_state()
867 void print_insn_state(struct bpf_verifier_env *env, const struct bpf_func_state *state) in print_insn_state() argument
869 if (env->prev_log_pos && env->prev_log_pos == env->log.end_pos) { in print_insn_state()
871 bpf_vlog_reset(&env->log, env->prev_log_pos - 1); in print_insn_state()
872 verbose(env, "%*c;", vlog_alignment(env->prev_insn_print_pos), ' '); in print_insn_state()
874 verbose(env, "%d:", env->insn_idx); in print_insn_state()
876 print_verifier_state(env, state, false); in print_insn_state()