Re: [PATCH v4 bpf-next 13/17] bpf: support standalone BTF in modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alan,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Alan-Maguire/btf-add-kind-layout-encoding-crcs-to-UAPI/20231112-205314
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20231112124834.388735-14-alan.maguire%40oracle.com
patch subject: [PATCH v4 bpf-next 13/17] bpf: support standalone BTF in modules
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231113/202311130324.ONOHc3XN-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231113/202311130324.ONOHc3XN-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311130324.ONOHc3XN-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> kernel/bpf/btf.c:8153:23: error: call to undeclared function 'btf_id_renumber'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                           set->pairs[i].id = btf_id_renumber(btf, set->pairs[i].id);
                                              ^
   kernel/bpf/btf.c:8290:15: error: call to undeclared function 'btf_id_renumber'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                           kfunc_id = btf_id_renumber(btf, kfunc_id);
                                      ^
   kernel/bpf/btf.c:8353:18: error: call to undeclared function 'btf_id_renumber'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                           dtor_btf_id = btf_id_renumber(btf, dtor_btf_id);
                                         ^
   kernel/bpf/btf.c:8455:27: error: call to undeclared function 'btf_id_renumber'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                           tab->dtors[i].btf_id = btf_id_renumber(btf, tab->dtors[i].btf_id);
                                                  ^
   4 errors generated.


vim +/btf_id_renumber +8153 kernel/bpf/btf.c

  8046	
  8047	static int btf_populate_kfunc_set(struct btf *btf, enum btf_kfunc_hook hook,
  8048					  const struct btf_kfunc_id_set *kset)
  8049	{
  8050		struct btf_kfunc_hook_filter *hook_filter;
  8051		struct btf_id_set8 *add_set = kset->set;
  8052		bool vmlinux_set = !btf_is_module(btf);
  8053		bool add_filter = !!kset->filter;
  8054		struct btf_kfunc_set_tab *tab;
  8055		struct btf_id_set8 *set;
  8056		u32 set_cnt;
  8057		int ret;
  8058	
  8059		if (hook >= BTF_KFUNC_HOOK_MAX) {
  8060			ret = -EINVAL;
  8061			goto end;
  8062		}
  8063	
  8064		if (!add_set->cnt)
  8065			return 0;
  8066	
  8067		tab = btf->kfunc_set_tab;
  8068	
  8069		if (tab && add_filter) {
  8070			u32 i;
  8071	
  8072			hook_filter = &tab->hook_filters[hook];
  8073			for (i = 0; i < hook_filter->nr_filters; i++) {
  8074				if (hook_filter->filters[i] == kset->filter) {
  8075					add_filter = false;
  8076					break;
  8077				}
  8078			}
  8079	
  8080			if (add_filter && hook_filter->nr_filters == BTF_KFUNC_FILTER_MAX_CNT) {
  8081				ret = -E2BIG;
  8082				goto end;
  8083			}
  8084		}
  8085	
  8086		if (!tab) {
  8087			tab = kzalloc(sizeof(*tab), GFP_KERNEL | __GFP_NOWARN);
  8088			if (!tab)
  8089				return -ENOMEM;
  8090			btf->kfunc_set_tab = tab;
  8091		}
  8092	
  8093		set = tab->sets[hook];
  8094		/* Warn when register_btf_kfunc_id_set is called twice for the same hook
  8095		 * for module sets.
  8096		 */
  8097		if (WARN_ON_ONCE(set && !vmlinux_set)) {
  8098			ret = -EINVAL;
  8099			goto end;
  8100		}
  8101	
  8102		/* We don't need to allocate, concatenate, and sort module sets, because
  8103		 * only one is allowed per hook. Hence, we can directly assign the
  8104		 * pointer and return.
  8105		 */
  8106		if (!vmlinux_set) {
  8107			tab->sets[hook] = add_set;
  8108			goto do_add_filter;
  8109		}
  8110	
  8111		/* In case of vmlinux sets, there may be more than one set being
  8112		 * registered per hook. To create a unified set, we allocate a new set
  8113		 * and concatenate all individual sets being registered. While each set
  8114		 * is individually sorted, they may become unsorted when concatenated,
  8115		 * hence re-sorting the final set again is required to make binary
  8116		 * searching the set using btf_id_set8_contains function work.
  8117		 */
  8118		set_cnt = set ? set->cnt : 0;
  8119	
  8120		if (set_cnt > U32_MAX - add_set->cnt) {
  8121			ret = -EOVERFLOW;
  8122			goto end;
  8123		}
  8124	
  8125		if (set_cnt + add_set->cnt > BTF_KFUNC_SET_MAX_CNT) {
  8126			ret = -E2BIG;
  8127			goto end;
  8128		}
  8129	
  8130		/* Grow set */
  8131		set = krealloc(tab->sets[hook],
  8132			       offsetof(struct btf_id_set8, pairs[set_cnt + add_set->cnt]),
  8133			       GFP_KERNEL | __GFP_NOWARN);
  8134		if (!set) {
  8135			ret = -ENOMEM;
  8136			goto end;
  8137		}
  8138	
  8139		/* For newly allocated set, initialize set->cnt to 0 */
  8140		if (!tab->sets[hook])
  8141			set->cnt = 0;
  8142		tab->sets[hook] = set;
  8143	
  8144		/* Concatenate the two sets */
  8145		memcpy(set->pairs + set->cnt, add_set->pairs, add_set->cnt * sizeof(set->pairs[0]));
  8146		if (btf->standalone_btf) {
  8147			u32 i;
  8148	
  8149			/* renumber BTF ids since BTF is standalone and has been mapped to look
  8150			 * like split BTF, while BTF kfunc ids are still old unmapped values.
  8151			 */
  8152			for (i = set->cnt; i < set->cnt + add_set->cnt; i++)
> 8153				set->pairs[i].id = btf_id_renumber(btf, set->pairs[i].id);
  8154		}
  8155	
  8156		set->cnt += add_set->cnt;
  8157	
  8158		sort(set->pairs, set->cnt, sizeof(set->pairs[0]), btf_id_cmp_func, NULL);
  8159	
  8160	do_add_filter:
  8161		if (add_filter) {
  8162			hook_filter = &tab->hook_filters[hook];
  8163			hook_filter->filters[hook_filter->nr_filters++] = kset->filter;
  8164		}
  8165		return 0;
  8166	end:
  8167		btf_free_kfunc_set_tab(btf);
  8168		return ret;
  8169	}
  8170	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux