Re: [PATCH bpf-next v4 1/3] bpf: Add skb dynptrs

kernel test robot
2022-08-23T23:53:17Z

Hi Joanne,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url: https://github.com/intel-lab-lkp/linux/commits/Joanne-Koong/Add-skb-xdp-dynptrs/20220823-080022
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: csky-randconfig-r022-20220823 (https://download.01.org/0day-ci/archive/20220824/202208240751.BRPS1SoF-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a2c8a74d8f0b7fd0b0008dc9bc5ccf9887317f36
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Joanne-Koong/Add-skb-xdp-dynptrs/20220823-080022
git checkout a2c8a74d8f0b7fd0b0008dc9bc5ccf9887317f36
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=csky SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

csky-linux-ld: kernel/bpf/helpers.o: in function `____bpf_dynptr_read':
>> kernel/bpf/helpers.c:1543: undefined reference to `__bpf_skb_load_bytes'
csky-linux-ld: kernel/bpf/helpers.o: in function `bpf_dynptr_read':
kernel/bpf/helpers.c:1522: undefined reference to `__bpf_skb_load_bytes'
csky-linux-ld: kernel/bpf/helpers.o: in function `____bpf_dynptr_write':
>> kernel/bpf/helpers.c:1584: undefined reference to `__bpf_skb_store_bytes'
csky-linux-ld: kernel/bpf/helpers.o: in function `bpf_dynptr_write':
kernel/bpf/helpers.c:1561: undefined reference to `__bpf_skb_store_bytes'

vim +1543 kernel/bpf/helpers.c

1521
1522 BPF_CALL_5(bpf_dynptr_read, void *, dst, u32, len, struct bpf_dynptr_kern *, src,
1523 u32, offset, u64, flags)
1524 {
1525 enum bpf_dynptr_type type;
1526 int err;
1527
1528 if (!src->data || flags)
1529 return -EINVAL;
1530
1531 err = bpf_dynptr_check_off_len(src, offset, len);
1532 if (err)
1533 return err;
1534
1535 type = bpf_dynptr_get_type(src);
1536
1537 switch (type) {
1538 case BPF_DYNPTR_TYPE_LOCAL:
1539 case BPF_DYNPTR_TYPE_RINGBUF:
1540 memcpy(dst, src->data + src->offset + offset, len);
1541 return 0;
1542 case BPF_DYNPTR_TYPE_SKB:
> 1543 return __bpf_skb_load_bytes(src->data, src->offset + offset, dst, len);
1544 default:
1545 WARN(true, "bpf_dynptr_read: unknown dynptr type %d\n", type);
1546 return -EFAULT;
1547 }
1548 }
1549
1550 static const struct bpf_func_proto bpf_dynptr_read_proto = {
1551 .func = bpf_dynptr_read,
1552 .gpl_only = false,
1553 .ret_type = RET_INTEGER,
1554 .arg1_type = ARG_PTR_TO_UNINIT_MEM,
1555 .arg2_type = ARG_CONST_SIZE_OR_ZERO,
1556 .arg3_type = ARG_PTR_TO_DYNPTR,
1557 .arg4_type = ARG_ANYTHING,
1558 .arg5_type = ARG_ANYTHING,
1559 };
1560
1561 BPF_CALL_5(bpf_dynptr_write, struct bpf_dynptr_kern *, dst, u32, offset, void *, src,
1562 u32, len, u64, flags)
1563 {
1564 enum bpf_dynptr_type type;
1565 int err;
1566
1567 if (!dst->data || bpf_dynptr_is_rdonly(dst))
1568 return -EINVAL;
1569
1570 err = bpf_dynptr_check_off_len(dst, offset, len);
1571 if (err)
1572 return err;
1573
1574 type = bpf_dynptr_get_type(dst);
1575
1576 switch (type) {
1577 case BPF_DYNPTR_TYPE_LOCAL:
1578 case BPF_DYNPTR_TYPE_RINGBUF:
1579 if (flags)
1580 return -EINVAL;
1581 memcpy(dst->data + dst->offset + offset, src, len);
1582 return 0;
1583 case BPF_DYNPTR_TYPE_SKB:
> 1584 return __bpf_skb_store_bytes(dst->data, dst->offset + offset, src, len,
1585 flags);
1586 default:
1587 WARN(true, "bpf_dynptr_write: unknown dynptr type %d\n", type);
1588 return -EFAULT;
1589 }
1590 }
1591

--
0-DAY CI Kernel Test Service