Re: [PATCH bpf-next v2 01/10] bpf: btf: Make some of the API visible outside BTF

From: KP Singh
Date: Mon Jan 20 2020 - 06:00:31 EST


Thanks! I have fixed this in the v3 of the series. btf_find_by_name_kind
is independant of CONFIG_BPF_SYSCALL and btf_type_by_name_kind needs
to be as well.

The mistake was adding a static inline definition of the function
in the !CONFIG_BPF_SYSCALL section which is not needed in this case.

- KP

On 18-Jan 20:44, kbuild test robot wrote:
> Hi KP,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on next-20200116]
> [cannot apply to bpf-next/master bpf/master linus/master security/next-testing v5.5-rc6 v5.5-rc5 v5.5-rc4 v5.5-rc6]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>
> url: https://github.com/0day-ci/linux/commits/KP-Singh/MAC-and-Audit-policy-using-eBPF-KRSI/20200117-070342
> base: 2747d5fdab78f43210256cd52fb2718e0b3cce74
> config: nds32-defconfig (attached as .config)
> compiler: nds32le-linux-gcc (GCC) 9.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=9.2.0 make.cross ARCH=nds32
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> In file included from kernel/bpf/core.c:27:
> >> include/linux/btf.h:148:38: error: static declaration of 'btf_type_by_name_kind' follows non-static declaration
> 148 | static inline const struct btf_type *btf_type_by_name_kind(
> | ^~~~~~~~~~~~~~~~~~~~~
> include/linux/btf.h:70:24: note: previous declaration of 'btf_type_by_name_kind' was here
> 70 | const struct btf_type *btf_type_by_name_kind(
> | ^~~~~~~~~~~~~~~~~~~~~
>
> vim +/btf_type_by_name_kind +148 include/linux/btf.h
>
> 136
> 137 #ifdef CONFIG_BPF_SYSCALL
> 138 const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id);
> 139 const char *btf_name_by_offset(const struct btf *btf, u32 offset);
> 140 struct btf *btf_parse_vmlinux(void);
> 141 struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog);
> 142 #else
> 143 static inline const struct btf_type *btf_type_by_id(const struct btf *btf,
> 144 u32 type_id)
> 145 {
> 146 return NULL;
> 147 }
> > 148 static inline const struct btf_type *btf_type_by_name_kind(
> 149 struct btf *btf, const char *name, u8 kind)
> 150 {
> 151 return ERR_PTR(-EOPNOTSUPP);
> 152 }
> 153 static inline const char *btf_name_by_offset(const struct btf *btf,
> 154 u32 offset)
> 155 {
> 156 return NULL;
> 157 }
> 158 #endif
> 159
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation