[PATCH RESEND bpf-next 15/18] bpf: take into account BPF token when fetching helper protos
Andrii Nakryiko
andrii.nakryiko at gmail.com
Fri Jun 2 20:07:57 UTC 2023
On Fri, Jun 2, 2023 at 11:48 AM kernel test robot <lkp at intel.com> wrote:
>
> Hi Andrii,
>
> 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/Andrii-Nakryiko/bpf-introduce-BPF-token-object/20230602-230448
> base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> patch link: https://lore.kernel.org/r/20230602150011.1657856-16-andrii%40kernel.org
> patch subject: [PATCH RESEND bpf-next 15/18] bpf: take into account BPF token when fetching helper protos
> config: um-x86_64_defconfig (https://download.01.org/0day-ci/archive/20230603/202306030252.UOXkWZTK-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build):
> # https://github.com/intel-lab-lkp/linux/commit/3d830ca845b075ab4132487aaaa69b70a467863c
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Andrii-Nakryiko/bpf-introduce-BPF-token-object/20230602-230448
> git checkout 3d830ca845b075ab4132487aaaa69b70a467863c
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=um SUBARCH=x86_64 olddefconfig
> make W=1 O=build_dir ARCH=um SUBARCH=x86_64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306030252.UOXkWZTK-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/bpf_verifier.h:7,
> from net/core/filter.c:21:
> include/linux/bpf.h: In function 'bpf_token_new_fd':
> include/linux/bpf.h:2475:16: warning: returning 'int' from a function with return type 'struct bpf_token *' makes pointer from integer without a cast [-Wint-conversion]
> 2475 | return -EOPNOTSUPP;
> | ^
bad copy/paste, this function should return int. I forgot to test that
everything compiles without CONFIG_BPF_SYSCALL.
> net/core/filter.c: In function 'bpf_sk_base_func_proto':
> >> net/core/filter.c:11653:14: error: implicit declaration of function 'bpf_token_capable'; did you mean 'bpf_token_put'? [-Werror=implicit-function-declaration]
> 11653 | if (!bpf_token_capable(prog->aux->token, CAP_PERFMON))
> | ^~~~~~~~~~~~~~~~~
> | bpf_token_put
> cc1: some warnings being treated as errors
>
>
hm.. maybe I'll just make bpf_token_capable() a static inline function
in include/linux/bpf.h
> vim +11653 net/core/filter.c
>
> 11619
> 11620 static const struct bpf_func_proto *
> 11621 bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> 11622 {
> 11623 const struct bpf_func_proto *func;
> 11624
> 11625 switch (func_id) {
> 11626 case BPF_FUNC_skc_to_tcp6_sock:
> 11627 func = &bpf_skc_to_tcp6_sock_proto;
> 11628 break;
> 11629 case BPF_FUNC_skc_to_tcp_sock:
> 11630 func = &bpf_skc_to_tcp_sock_proto;
> 11631 break;
> 11632 case BPF_FUNC_skc_to_tcp_timewait_sock:
> 11633 func = &bpf_skc_to_tcp_timewait_sock_proto;
> 11634 break;
> 11635 case BPF_FUNC_skc_to_tcp_request_sock:
> 11636 func = &bpf_skc_to_tcp_request_sock_proto;
> 11637 break;
> 11638 case BPF_FUNC_skc_to_udp6_sock:
> 11639 func = &bpf_skc_to_udp6_sock_proto;
> 11640 break;
> 11641 case BPF_FUNC_skc_to_unix_sock:
> 11642 func = &bpf_skc_to_unix_sock_proto;
> 11643 break;
> 11644 case BPF_FUNC_skc_to_mptcp_sock:
> 11645 func = &bpf_skc_to_mptcp_sock_proto;
> 11646 break;
> 11647 case BPF_FUNC_ktime_get_coarse_ns:
> 11648 return &bpf_ktime_get_coarse_ns_proto;
> 11649 default:
> 11650 return bpf_base_func_proto(func_id, prog);
> 11651 }
> 11652
> 11653 if (!bpf_token_capable(prog->aux->token, CAP_PERFMON))
> 11654 return NULL;
> 11655
> 11656 return func;
> 11657 }
> 11658
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
More information about the Linux-security-module-archive
mailing list