From: kernel test robot <lkp@intel.com>
To: Sasha Levin <sashal@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC] btf: split core BTF parsing out of BPF subsystem into kernel/btf/
Date: Sun, 29 Mar 2026 01:49:27 +0800 [thread overview]
Message-ID: <202603290107.PMM2AhwK-lkp@intel.com> (raw)
In-Reply-To: <20260325011853.657295-1-sashal@kernel.org>
Hi Sasha,
[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master akpm-mm/mm-nonmm-unstable linus/master v7.0-rc5]
[cannot apply to bpf-next/net next-20260327]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sasha-Levin/btf-split-core-BTF-parsing-out-of-BPF-subsystem-into-kernel-btf/20260327-005818
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20260325011853.657295-1-sashal%40kernel.org
patch subject: [RFC] btf: split core BTF parsing out of BPF subsystem into kernel/btf/
config: sh-allyesconfig (https://download.01.org/0day-ci/archive/20260329/202603290107.PMM2AhwK-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/202603290107.PMM2AhwK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603290107.PMM2AhwK-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/bpf/verifier.c: In function 'map_kptr_match_type':
>> kernel/bpf/verifier.c:6070:34: warning: '%s' directive argument is null [-Wformat-overflow=]
6070 | verbose(env, "expected=%s%s", reg_type_str(env, PTR_TO_BTF_ID), targ_name);
| ^~
kernel/bpf/verifier.c:6072:37: warning: '%s' directive argument is null [-Wformat-overflow=]
6072 | verbose(env, " or %s%s\n", reg_type_str(env, PTR_TO_BTF_ID | PTR_UNTRUSTED),
| ^~
kernel/bpf/verifier.c: In function 'check_reg_type':
kernel/bpf/verifier.c:9610:62: warning: '%s' directive argument is null [-Wformat-overflow=]
9610 | verbose(env, "R%d is of type %s but %s is expected\n",
| ^~
kernel/bpf/verifier.c: In function 'check_ptr_to_map_access':
kernel/bpf/verifier.c:7617:46: warning: '%s' directive argument is null [-Wformat-overflow=]
7617 | verbose(env, "only read from %s is supported\n", tname);
| ^~
kernel/bpf/verifier.c:7611:38: warning: '%s' directive argument is null [-Wformat-overflow=]
7611 | verbose(env, "R%d is %s invalid negative access: off=%d\n",
| ^~
kernel/bpf/verifier.c:7605:34: warning: '%s' directive argument is null [-Wformat-overflow=]
7605 | "'struct %s' access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN\n",
| ^~
kernel/bpf/verifier.c: In function 'check_ptr_to_btf_access':
kernel/bpf/verifier.c:7439:55: warning: '%s' directive argument is null [-Wformat-overflow=]
7439 | "Cannot access kernel 'struct %s' from non-GPL compatible program\n",
| ^~
kernel/bpf/verifier.c:7472:37: warning: '%s' directive argument is null [-Wformat-overflow=]
7472 | "R%d is ptr_%s access percpu memory: off=%d\n",
| ^~
kernel/bpf/verifier.c:7465:37: warning: '%s' directive argument is null [-Wformat-overflow=]
7465 | "R%d is ptr_%s access user memory: off=%d\n",
| ^~
kernel/bpf/verifier.c:7458:37: warning: '%s' directive argument is null [-Wformat-overflow=]
7458 | "R%d is ptr_%s invalid negative access: off=%d\n",
| ^~
kernel/bpf/verifier.c:7449:37: warning: '%s' directive argument is null [-Wformat-overflow=]
7449 | "R%d is ptr_%s invalid variable offset: off=%d, var_off=%s\n",
| ^~
kernel/bpf/verifier.c:7433:34: warning: '%s' directive argument is null [-Wformat-overflow=]
7433 | "'struct %s' access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN\n",
| ^~
kernel/bpf/verifier.c: In function 'check_helper_call.isra':
kernel/bpf/verifier.c:12067:83: warning: '%s' directive argument is null [-Wformat-overflow=]
12067 | verbose(env, "unable to resolve the size of type '%s': %ld\n",
| ^~
--
kernel/bpf/log.c: In function 'print_reg_state':
>> kernel/bpf/log.c:702:30: warning: '%s' directive argument is null [-Wformat-overflow=]
702 | verbose(env, "%s", btf_type_name(reg->btf, reg->btf_id));
| ^~~~
kernel/bpf/log.c:14:64: note: in definition of macro 'verbose'
14 | #define verbose(env, fmt, args...) bpf_verifier_log_write(env, fmt, ##args)
| ^~~
kernel/bpf/log.c:702:31: note: format string is defined here
702 | verbose(env, "%s", btf_type_name(reg->btf, reg->btf_id));
| ^~
--
In file included from kernel/bpf/btf_relocate.c:2:
kernel/bpf/../../tools/lib/bpf/btf_relocate.c: In function 'btf_relocate_rewrite_strs':
kernel/bpf/../../tools/lib/bpf/btf_relocate.c:20:49: error: implicit declaration of function 'btf_str_by_offset'; did you mean 'btf__str_by_offset'? [-Wimplicit-function-declaration]
20 | #define btf__str_by_offset btf_str_by_offset
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:483:33: note: in expansion of macro 'btf__str_by_offset'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/printk.h:511:26: note: in expansion of macro 'printk_index_wrap'
511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/printk.h:564:9: note: in expansion of macro 'printk'
564 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
kernel/bpf/../../tools/lib/bpf/btf_relocate.c:431:33: note: in expansion of macro 'pr_warn'
431 | pr_warn("string '%s' [offset %u] is not mapped to base BTF\n",
| ^~~~~~~
In file included from include/asm-generic/bug.h:31,
from arch/sh/include/asm/bug.h:112,
from include/linux/bug.h:5,
from include/linux/alloc_tag.h:8,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:11,
from kernel/bpf/../../tools/lib/bpf/btf_relocate.c:9:
>> include/linux/kern_levels.h:5:25: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/printk.h:483:25: note: in definition of macro 'printk_index_wrap'
483 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
include/linux/printk.h:564:9: note: in expansion of macro 'printk'
564 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
include/linux/kern_levels.h:12:25: note: in expansion of macro 'KERN_SOH'
12 | #define KERN_WARNING KERN_SOH "4" /* warning conditions */
| ^~~~~~~~
include/linux/printk.h:564:16: note: in expansion of macro 'KERN_WARNING'
564 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~
kernel/bpf/../../tools/lib/bpf/btf_relocate.c:431:33: note: in expansion of macro 'pr_warn'
431 | pr_warn("string '%s' [offset %u] is not mapped to base BTF\n",
| ^~~~~~~
vim +6070 kernel/bpf/verifier.c
e9147b4422e1f3 Kumar Kartikeya Dwivedi 2022-04-15 6002
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6003 static int map_kptr_match_type(struct bpf_verifier_env *env,
aa3496accc412b Kumar Kartikeya Dwivedi 2022-11-04 6004 struct btf_field *kptr_field,
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6005 struct bpf_reg_state *reg, u32 regno)
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6006 {
b32a5dae44cc73 Dave Marchevsky 2023-03-09 6007 const char *targ_name = btf_type_name(kptr_field->kptr.btf, kptr_field->kptr.btf_id);
ab6c637ad0276e Yonghong Song 2023-08-21 6008 int perm_flags;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6009 const char *reg_name = "";
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6010
ab6c637ad0276e Yonghong Song 2023-08-21 6011 if (btf_is_kernel(reg->btf)) {
ab6c637ad0276e Yonghong Song 2023-08-21 6012 perm_flags = PTR_MAYBE_NULL | PTR_TRUSTED | MEM_RCU;
ab6c637ad0276e Yonghong Song 2023-08-21 6013
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6014 /* Only unreferenced case accepts untrusted pointers */
aa3496accc412b Kumar Kartikeya Dwivedi 2022-11-04 6015 if (kptr_field->type == BPF_KPTR_UNREF)
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6016 perm_flags |= PTR_UNTRUSTED;
ab6c637ad0276e Yonghong Song 2023-08-21 6017 } else {
ab6c637ad0276e Yonghong Song 2023-08-21 6018 perm_flags = PTR_MAYBE_NULL | MEM_ALLOC;
36d8bdf75a9319 Yonghong Song 2023-08-27 6019 if (kptr_field->type == BPF_KPTR_PERCPU)
36d8bdf75a9319 Yonghong Song 2023-08-27 6020 perm_flags |= MEM_PERCPU;
ab6c637ad0276e Yonghong Song 2023-08-21 6021 }
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6022
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6023 if (base_type(reg->type) != PTR_TO_BTF_ID || (type_flag(reg->type) & ~perm_flags))
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6024 goto bad_type;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6025
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6026 /* We need to verify reg->type and reg->btf, before accessing reg->btf */
b32a5dae44cc73 Dave Marchevsky 2023-03-09 6027 reg_name = btf_type_name(reg->btf, reg->btf_id);
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6028
c0a5a21c25f37c Kumar Kartikeya Dwivedi 2022-04-25 6029 /* For ref_ptr case, release function check should ensure we get one
c0a5a21c25f37c Kumar Kartikeya Dwivedi 2022-04-25 6030 * referenced PTR_TO_BTF_ID, and that its fixed offset is 0. For the
c0a5a21c25f37c Kumar Kartikeya Dwivedi 2022-04-25 6031 * normal store of unreferenced kptr, we must ensure var_off is zero.
022ac075088366 Eduard Zingerman 2026-02-12 6032 * Since ref_ptr cannot be accessed directly by BPF insns, check for
022ac075088366 Eduard Zingerman 2026-02-12 6033 * reg->ref_obj_id is not needed here.
c0a5a21c25f37c Kumar Kartikeya Dwivedi 2022-04-25 6034 */
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6035 if (__check_ptr_off_reg(env, reg, regno, true))
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6036 return -EACCES;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6037
ab6c637ad0276e Yonghong Song 2023-08-21 6038 /* A full type match is needed, as BTF can be vmlinux, module or prog BTF, and
022ac075088366 Eduard Zingerman 2026-02-12 6039 * we also need to take into account the reg->var_off.
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6040 *
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6041 * We want to support cases like:
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6042 *
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6043 * struct foo {
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6044 * struct bar br;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6045 * struct baz bz;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6046 * };
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6047 *
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6048 * struct foo *v;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6049 * v = func(); // PTR_TO_BTF_ID
022ac075088366 Eduard Zingerman 2026-02-12 6050 * val->foo = v; // reg->var_off is zero, btf and btf_id match type
022ac075088366 Eduard Zingerman 2026-02-12 6051 * val->bar = &v->br; // reg->var_off is still zero, but we need to retry with
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6052 * // first member type of struct after comparison fails
022ac075088366 Eduard Zingerman 2026-02-12 6053 * val->baz = &v->bz; // reg->var_off is non-zero, so struct needs to be walked
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6054 * // to match type
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6055 *
022ac075088366 Eduard Zingerman 2026-02-12 6056 * In the kptr_ref case, check_func_arg_reg_off already ensures reg->var_off
2ab3b3808eb17f Kumar Kartikeya Dwivedi 2022-04-25 6057 * is zero. We must also ensure that btf_struct_ids_match does not walk
2ab3b3808eb17f Kumar Kartikeya Dwivedi 2022-04-25 6058 * the struct to match type against first member of struct, i.e. reject
2ab3b3808eb17f Kumar Kartikeya Dwivedi 2022-04-25 6059 * second case from above. Hence, when type is BPF_KPTR_REF, we set
2ab3b3808eb17f Kumar Kartikeya Dwivedi 2022-04-25 6060 * strict mode to true for type match.
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6061 */
022ac075088366 Eduard Zingerman 2026-02-12 6062 if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->var_off.value,
aa3496accc412b Kumar Kartikeya Dwivedi 2022-11-04 6063 kptr_field->kptr.btf, kptr_field->kptr.btf_id,
36d8bdf75a9319 Yonghong Song 2023-08-27 6064 kptr_field->type != BPF_KPTR_UNREF))
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6065 goto bad_type;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6066 return 0;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6067 bad_type:
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6068 verbose(env, "invalid kptr access, R%d type=%s%s ", regno,
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6069 reg_type_str(env, reg->type), reg_name);
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 @6070 verbose(env, "expected=%s%s", reg_type_str(env, PTR_TO_BTF_ID), targ_name);
aa3496accc412b Kumar Kartikeya Dwivedi 2022-11-04 6071 if (kptr_field->type == BPF_KPTR_UNREF)
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6072 verbose(env, " or %s%s\n", reg_type_str(env, PTR_TO_BTF_ID | PTR_UNTRUSTED),
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6073 targ_name);
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6074 else
6efe152d4061a8 Kumar Kartikeya Dwivedi 2022-04-25 6075 verbose(env, "\n");
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6076 return -EINVAL;
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6077 }
61df10c7799e27 Kumar Kartikeya Dwivedi 2022-04-25 6078
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-03-28 17:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 16:48 [PATCH 0/2] kallsyms: show typed function parameters in oops/WARN dumps Sasha Levin
2026-03-23 16:48 ` [PATCH 1/2] kallsyms: show function parameter info " Sasha Levin
2026-03-24 15:03 ` Alexei Starovoitov
2026-03-24 16:00 ` Sasha Levin
2026-03-24 16:04 ` Alexei Starovoitov
2026-03-24 18:44 ` Sasha Levin
2026-03-25 1:18 ` [RFC] btf: split core BTF parsing out of BPF subsystem into kernel/btf/ Sasha Levin
2026-03-25 2:15 ` bot+bpf-ci
2026-03-28 17:49 ` kernel test robot [this message]
2026-03-28 18:21 ` kernel test robot
2026-03-28 20:19 ` kernel test robot
2026-04-22 10:44 ` Alan Maguire
2026-04-22 14:48 ` Alexei Starovoitov
2026-03-24 17:34 ` [PATCH 1/2] kallsyms: show function parameter info in oops/WARN dumps Alan Maguire
2026-03-24 18:51 ` Sasha Levin
2026-04-25 1:59 ` sashiko-bot
2026-03-23 16:48 ` [PATCH 2/2] kallsyms: add BTF-based deep parameter rendering in oops dumps Sasha Levin
2026-03-24 15:07 ` Alexei Starovoitov
2026-04-25 2:15 ` sashiko-bot
2026-03-23 18:43 ` [PATCH 0/2] kallsyms: show typed function parameters in oops/WARN dumps Alexey Dobriyan
2026-03-23 22:58 ` Sasha Levin
2026-03-23 22:50 ` Andrew Morton
2026-03-23 23:08 ` Sasha Levin
2026-03-24 8:57 ` Jiri Olsa
2026-03-24 11:39 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202603290107.PMM2AhwK-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sashal@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.