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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 21 Mar 2022 10:41:01 -0700
From:   Joanne Koong <joannelkoong@...il.com>
To:     kernel test robot <lkp@...el.com>
Cc:     kbuild-all@...ts.01.org,
        "GNU/Weeb Mailing List" <gwml@...r.gnuweeb.org>,
        linux-kernel@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>
Subject: Re: [ammarfaizi2-block:bpf/bpf-next/master 244/254]
 kernel/bpf/verifier.c:13499:47: sparse: sparse: cast from restricted gfp_t

On Sun, Mar 20, 2022 at 11:58 PM kernel test robot <lkp@...el.com> wrote:
>
> tree:   https://github.com/ammarfaizi2/linux-block bpf/bpf-next/master
> head:   7ada3787e91c89b0aa7abf47682e8e587b855c13
> commit: b00fa38a9c1cba044a32a601b49a55a18ed719d1 [244/254] bpf: Enable non-atomic allocations in local storage
> config: csky-randconfig-s032-20220320 (https://download.01.org/0day-ci/archive/20220321/202203211432.Fx74gYS9-lkp@intel.com/config)
> compiler: csky-linux-gcc (GCC) 11.2.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.4-dirty
>         # https://github.com/ammarfaizi2/linux-block/commit/b00fa38a9c1cba044a32a601b49a55a18ed719d1
>         git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
>         git fetch --no-tags ammarfaizi2-block bpf/bpf-next/master
>         git checkout b00fa38a9c1cba044a32a601b49a55a18ed719d1
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash kernel/bpf/
>
> 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/verifier.c:13499:47: sparse: sparse: cast from restricted gfp_t
>    kernel/bpf/verifier.c:13501:47: sparse: sparse: cast from restricted gfp_t
>    kernel/bpf/verifier.c:13746:38: sparse: sparse: subtraction of functions? Share your drugs
>    kernel/bpf/verifier.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h, ...):
>    arch/csky/include/asm/uaccess.h:121:17: sparse: sparse: cast removes address space '__user' of expression
>    arch/csky/include/asm/uaccess.h:121:17: sparse: sparse: asm output is not an lvalue
>    arch/csky/include/asm/uaccess.h:121:17: sparse: sparse: cast removes address space '__user' of expression
>    arch/csky/include/asm/uaccess.h:121:17: sparse: sparse: generating address of non-lvalue (11)
>    kernel/bpf/verifier.c: note: in included file (through include/linux/bpf.h, include/linux/bpf-cgroup.h):
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
>    include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
>
> vim +13499 kernel/bpf/verifier.c
>
>  13236
[...]
>  13485                          new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
>  13486                          if (!new_prog)
>  13487                                  return -ENOMEM;
>  13488
>  13489                          delta    += cnt - 1;
>  13490                          env->prog = prog = new_prog;
>  13491                          insn      = new_prog->insnsi + i + delta;
>  13492                          goto patch_call_imm;
>  13493                  }
>  13494
>  13495                  if (insn->imm == BPF_FUNC_task_storage_get ||
>  13496                      insn->imm == BPF_FUNC_sk_storage_get ||
>  13497                      insn->imm == BPF_FUNC_inode_storage_get) {
>  13498                          if (env->prog->aux->sleepable)
>  13499                                  insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_KERNEL);
>  13500                          else
>  13501                                  insn_buf[0] = BPF_MOV64_IMM(BPF_REG_5, (__s32)GFP_ATOMIC);

Sorry for causing this, I will submit a fix.

>  13502                          insn_buf[1] = *insn;
>  13503                          cnt = 2;
>  13504
>  13505                          new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
>  13506                          if (!new_prog)
>  13507                                  return -ENOMEM;
>  13508
[...]
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ