Lines Matching refs:log
173 /* length of verifier log at the time this state was pushed on stack */
280 void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt, va_list args)
284 n = vscnprintf(log->kbuf, BPF_VERIFIER_TMP_LOG_SIZE, fmt, args);
286 WARN_ONCE(n >= BPF_VERIFIER_TMP_LOG_SIZE - 1, "verifier log line truncated - local buffer too short\n");
288 n = min(log->len_total - log->len_used - 1, n);
289 log->kbuf[n] = '\0';
291 if (log->level == BPF_LOG_KERNEL) {
292 pr_err("BPF:%s\n", log->kbuf);
295 if (!copy_to_user(log->ubuf + log->len_used, log->kbuf, n + 1)) {
296 log->len_used += n;
298 log->ubuf = NULL;
302 static void bpf_vlog_reset(struct bpf_verifier_log *log, u32 new_pos)
306 if (!bpf_verifier_log_needed(log)) {
310 log->len_used = new_pos;
311 if (put_user(zero, log->ubuf + new_pos)) {
312 log->ubuf = NULL;
317 * bpf_verifier_log_write() is used to dump the verification trace to the log,
324 if (!bpf_verifier_log_needed(&env->log)) {
329 bpf_verifier_vlog(&env->log, fmt, args);
339 if (!bpf_verifier_log_needed(&env->log)) {
344 bpf_verifier_vlog(&env->log, fmt, args);
348 __printf(2, 3) void bpf_log(struct bpf_verifier_log *log, const char *fmt, ...)
352 if (!bpf_verifier_log_needed(log)) {
357 bpf_verifier_vlog(log, fmt, args);
374 if (!bpf_verifier_log_needed(&env->log)) {
387 bpf_verifier_vlog(&env->log, prefix_fmt, args);
936 bpf_vlog_reset(&env->log, head->log_pos);
967 elem->log_pos = env->log.len_used;
1485 if (env->log.level & BPF_LOG_LEVEL2) {
1812 if (env->log.level & BPF_LOG_LEVEL) {
2090 if (env->log.level & BPF_LOG_LEVEL) {
2185 if (env->log.level & BPF_LOG_LEVEL) {
2822 if (env->log.level & BPF_LOG_LEVEL) {
2983 .log = &env->log,
3527 ret = env->ops->btf_struct_access(&env->log, t, off, size, atype, &btf_id);
3534 ret = btf_struct_access(&env->log, t, off, size, atype, &btf_id);
3586 ret = btf_struct_access(&env->log, t, off, size, atype, &btf_id);
4399 if (!btf_struct_ids_match(&env->log, reg->off, reg->btf_id, *arg_btf_id)) {
5101 if (env->log.level & BPF_LOG_LEVEL) {
5151 if (env->log.level & BPF_LOG_LEVEL) {
5192 if (env->log.level & BPF_LOG_LEVEL) {
7975 if (env->log.level & BPF_LOG_LEVEL) {
9360 if (env->log.level & BPF_LOG_LEVEL2) {
9377 if (env->log.level & BPF_LOG_LEVEL2) {
9654 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2);
9687 if (env->log.level & BPF_LOG_LEVEL) {
9706 if ((env->log.level & BPF_LOG_LEVEL2) || ((env->log.level & BPF_LOG_LEVEL) && do_print_state)) {
9707 if (env->log.level & BPF_LOG_LEVEL2) {
9717 if (env->log.level & BPF_LOG_LEVEL) {
11588 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2);
11656 bpf_vlog_reset(&env->log, 0);
11697 } else if (env->log.level & BPF_LOG_LEVEL) {
11720 if (env->log.level & BPF_LOG_STATS) {
11831 int bpf_check_attach_target(struct bpf_verifier_log *log, const struct bpf_prog *prog, const struct bpf_prog *tgt_prog,
11844 bpf_log(log, "Tracing programs must provide btf_id\n");
11849 bpf_log(log, "FENTRY/FEXIT program can only be attached to another program annotated with BTF\n");
11854 bpf_log(log, "attach_btf_id %u is invalid\n", btf_id);
11859 bpf_log(log, "attach_btf_id %u doesn't have a name\n", btf_id);
11872 bpf_log(log, "Subprog %s doesn't exist\n", tname);
11878 bpf_log(log, "Cannot replace static functions\n");
11882 bpf_log(log, "Extension programs should be JITed\n");
11887 bpf_log(log, "Can attach to only JITed progs\n");
11895 bpf_log(log, "Cannot recursively attach\n");
11915 bpf_log(log, "Cannot extend fentry/fexit\n");
11920 bpf_log(log, "Cannot replace kernel functions\n");
11928 bpf_log(log, "Only FENTRY/FEXIT progs are attachable to another BPF prog\n");
11932 bpf_log(log, "attach_btf_id %u is not a typedef\n", btf_id);
11936 bpf_log(log, "attach_btf_id %u points to wrong type name %s\n", btf_id, tname);
11954 bpf_log(log, "attach_btf_id %u is not a function\n", btf_id);
11961 ret = btf_distill_func_proto(log, btf, t, tname, &tgt_info->fmodel);
11976 bpf_log(log, "attach_btf_id %u is not a function\n", btf_id);
11979 if (prog_extension && btf_check_type_match(log, prog, btf, t)) {
11997 ret = btf_distill_func_proto(log, btf, t, tname, &tgt_info->fmodel);
12011 bpf_log(log, "The address of function %s cannot be found\n", tname);
12039 bpf_log(log, "%s is not sleepable\n", tname);
12044 bpf_log(log, "can't modify return codes of BPF programs\n");
12049 bpf_log(log, "%s() is not modifiable\n", tname);
12085 ret = bpf_check_attach_target(&env->log, prog, tgt_prog, btf_id, &tgt_info);
12119 ret = bpf_lsm_verify_prog(&env->log, prog);
12151 struct bpf_verifier_log *log;
12167 log = &env->log;
12193 log->level = attr->log_level;
12194 log->ubuf = (char __user *)(unsigned long)attr->log_buf;
12195 log->len_total = attr->log_size;
12197 /* log attributes have to be sane */
12198 if (!bpf_verifier_log_attr_valid(log)) {
12323 if (log->level && bpf_verifier_log_full(log)) {
12326 if (log->level && !log->ubuf) {