Re: [PATCH 5/7] bpf: Add BPF_FETCH field / create atomic_fetch_add instruction

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

 



Hi Brendan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]
[also build test WARNING on bpf/master powerpc/next linus/master v5.10-rc5 next-20201123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Brendan-Jackman/Atomics-for-eBPF/20201124-013549
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arc-randconfig-s031-20201123 (attached as .config)
compiler: arc-elf-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.3-134-gb59dbdaf-dirty
        # https://github.com/0day-ci/linux/commit/b2b5923320904ef8c33183e8e88042588eb99397
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Brendan-Jackman/Atomics-for-eBPF/20201124-013549
        git checkout b2b5923320904ef8c33183e8e88042588eb99397
        # 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=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
   kernel/bpf/core.c:209:49: sparse: sparse: arithmetics on pointers to functions
   kernel/bpf/core.c:1521:43: sparse: sparse: arithmetics on pointers to functions
   kernel/bpf/core.c:1526:48: sparse: sparse: arithmetics on pointers to functions
   kernel/bpf/core.c:1742:77: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/core.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/xdp.h, ...):
   include/trace/events/xdp.h:308:1: sparse: sparse: Using plain integer as NULL pointer
   include/trace/events/xdp.h:335:1: sparse: sparse: Using plain integer as NULL pointer
   include/trace/events/xdp.h:369:1: sparse: sparse: Using plain integer as NULL pointer
>> kernel/bpf/core.c:1656:60: sparse: sparse: non size-preserving integer to pointer cast

vim +1656 kernel/bpf/core.c

  1628	
  1629		STX_ATOMIC_W:
  1630			switch (IMM) {
  1631			case BPF_ADD:
  1632				/* lock xadd *(u32 *)(dst_reg + off16) += src_reg */
  1633				atomic_add((u32) SRC, (atomic_t *)(unsigned long)
  1634					   (DST + insn->off));
  1635				break;
  1636			case BPF_ADD | BPF_FETCH:
  1637				SRC = (u32) atomic_fetch_add(
  1638					(u32) SRC,
  1639					(atomic_t *)(unsigned long) (DST + insn->off));
  1640				break;
  1641			default:
  1642				goto default_label;
  1643			}
  1644			CONT;
  1645	
  1646		STX_ATOMIC_DW:
  1647			switch (IMM) {
  1648			case BPF_ADD:
  1649				/* lock xadd *(u64 *)(dst_reg + off16) += src_reg */
  1650				atomic64_add((u64) SRC, (atomic64_t *)(unsigned long)
  1651					     (DST + insn->off));
  1652				break;
  1653			case BPF_ADD | BPF_FETCH:
  1654				SRC = (u64) atomic64_fetch_add(
  1655					(u64) SRC,
> 1656					(atomic64_t *)(s64) (DST + insn->off));
  1657				break;
  1658			default:
  1659				goto default_label;
  1660			}
  1661			CONT;
  1662	
  1663		default_label:
  1664			/* If we ever reach this, we have a bug somewhere. Die hard here
  1665			 * instead of just returning 0; we could be somewhere in a subprog,
  1666			 * so execution could continue otherwise which we do /not/ want.
  1667			 *
  1668			 * Note, verifier whitelists all opcodes in bpf_opcode_in_insntable().
  1669			 */
  1670			pr_warn("BPF interpreter: unknown opcode %02x (imm: 0x%x)\n",
  1671				insn->code, insn->imm);
  1672			BUG_ON(1);
  1673			return 0;
  1674	}
  1675	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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