lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 21 Sep 2020 11:11:01 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Hao Luo <haoluo@...gle.com>
Cc:     kernel test robot <lkp@...el.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>, kbuild-all@...ts.01.org,
        Shuah Khan <skhan@...uxfoundation.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andriin@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>
Subject: Re: [PATCH bpf-next v3 4/6] bpf: Introduce bpf_per_cpu_ptr()

On Thu, Sep 17, 2020 at 12:14 PM Hao Luo <haoluo@...gle.com> wrote:
>
> I need to cast the pointer to "const void __percpu *" before passing
> into per_cpu_ptr. I will update and resend.

You can try just declaring it as __percpu in BPF_CALL_2 macro. That
might work, or not, depending on how exactly BPF_CALL macros are
implemented (I haven't checked).

>
> On Wed, Sep 16, 2020 at 6:14 PM kernel test robot <lkp@...el.com> wrote:
> >
> > Hi Hao,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on bpf-next/master]
> >
> > url:    https://github.com/0day-ci/linux/commits/Hao-Luo/bpf-BTF-support-for-ksyms/20200917-064052
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> > config: powerpc-randconfig-s032-20200916 (attached as .config)
> > compiler: powerpc64-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # apt-get install sparse
> >         # sparse version: v0.6.2-201-g24bdaac6-dirty
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> >
> > >> kernel/bpf/helpers.c:631:31: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const [noderef] __percpu *__vpp_verify @@     got void const * @@
> > >> kernel/bpf/helpers.c:631:31: sparse:     expected void const [noderef] __percpu *__vpp_verify
> > >> kernel/bpf/helpers.c:631:31: sparse:     got void const *
> >
> > # https://github.com/0day-ci/linux/commit/3f6ea3c1c73efe466a96ff7499219fe3b03b8f48
> > git remote add linux-review https://github.com/0day-ci/linux
> > git fetch --no-tags linux-review Hao-Luo/bpf-BTF-support-for-ksyms/20200917-064052
> > git checkout 3f6ea3c1c73efe466a96ff7499219fe3b03b8f48
> > vim +631 kernel/bpf/helpers.c
> >
> >    625
> >    626  BPF_CALL_2(bpf_per_cpu_ptr, const void *, ptr, u32, cpu)
> >    627  {
> >    628          if (cpu >= nr_cpu_ids)
> >    629                  return (unsigned long)NULL;
> >    630
> >  > 631          return (unsigned long)per_cpu_ptr(ptr, cpu);
> >    632  }
> >    633
> >    634  const struct bpf_func_proto bpf_per_cpu_ptr_proto = {
> >    635          .func           = bpf_per_cpu_ptr,
> >    636          .gpl_only       = false,
> >    637          .ret_type       = RET_PTR_TO_MEM_OR_BTF_ID_OR_NULL,
> >    638          .arg1_type      = ARG_PTR_TO_PERCPU_BTF_ID,
> >    639          .arg2_type      = ARG_ANYTHING,
> >    640  };
> >    641
> >  > 642  const struct bpf_func_proto bpf_get_current_task_proto __weak;
> >    643  const struct bpf_func_proto bpf_probe_read_user_proto __weak;
> >    644  const struct bpf_func_proto bpf_probe_read_user_str_proto __weak;
> >    645  const struct bpf_func_proto bpf_probe_read_kernel_proto __weak;
> >    646  const struct bpf_func_proto bpf_probe_read_kernel_str_proto __weak;
> >    647
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists