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] [thread-next>] [day] [month] [year] [list]
Message-ID: <201910030245.Ozf2sARI%lkp@intel.com>
Date:   Thu, 3 Oct 2019 02:07:24 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     kbuild-all@...org, Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Marek Majkowski <marek@...udflare.com>,
        Lorenz Bauer <lmb@...udflare.com>,
        David Miller <davem@...emloft.net>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next 3/9] xdp: Support setting and getting device
 chain map

Hi "Toke,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Toke-H-iland-J-rgensen/xdp-Support-multiple-programs-on-a-single-interface-through-chain-calls/20191003-005238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>):

   net/core/dev.c: In function 'dev_xdp_uninstall':
>> net/core/dev.c:8187:3: error: implicit declaration of function 'bpf_map_put_with_uref' [-Werror=implicit-function-declaration]
      bpf_map_put_with_uref(chain_map);
      ^~~~~~~~~~~~~~~~~~~~~
   net/core/dev.c: In function 'dev_change_xdp_fd':
>> net/core/dev.c:8286:15: error: implicit declaration of function 'bpf_map_get_with_uref'; did you mean 'bpf_obj_get_user'? [-Werror=implicit-function-declaration]
      chain_map = bpf_map_get_with_uref(chain_map_fd);
                  ^~~~~~~~~~~~~~~~~~~~~
                  bpf_obj_get_user
>> net/core/dev.c:8286:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      chain_map = bpf_map_get_with_uref(chain_map_fd);
                ^
   cc1: some warnings being treated as errors

vim +/bpf_map_put_with_uref +8187 net/core/dev.c

  8177	
  8178	static void dev_xdp_uninstall(struct net_device *dev)
  8179	{
  8180		struct bpf_map *chain_map = NULL;
  8181		struct netdev_bpf xdp;
  8182		bpf_op_t ndo_bpf;
  8183	
  8184		/* Remove chain map */
  8185		rcu_swap_protected(dev->xdp_chain_map, chain_map, 1);
  8186		if(chain_map)
> 8187			bpf_map_put_with_uref(chain_map);
  8188	
  8189		/* Remove generic XDP */
  8190		WARN_ON(dev_xdp_install(dev, generic_xdp_install, NULL, 0, NULL));
  8191	
  8192		/* Remove from the driver */
  8193		ndo_bpf = dev->netdev_ops->ndo_bpf;
  8194		if (!ndo_bpf)
  8195			return;
  8196	
  8197		memset(&xdp, 0, sizeof(xdp));
  8198		xdp.command = XDP_QUERY_PROG;
  8199		WARN_ON(ndo_bpf(dev, &xdp));
  8200		if (xdp.prog_id)
  8201			WARN_ON(dev_xdp_install(dev, ndo_bpf, NULL, xdp.prog_flags,
  8202						NULL));
  8203	
  8204		/* Remove HW offload */
  8205		memset(&xdp, 0, sizeof(xdp));
  8206		xdp.command = XDP_QUERY_PROG_HW;
  8207		if (!ndo_bpf(dev, &xdp) && xdp.prog_id)
  8208			WARN_ON(dev_xdp_install(dev, ndo_bpf, NULL, xdp.prog_flags,
  8209						NULL));
  8210	}
  8211	
  8212	/**
  8213	 *	dev_change_xdp_fd - set or clear a bpf program for a device rx path
  8214	 *	@dev: device
  8215	 *	@extack: netlink extended ack
  8216	 *	@prog_fd: new program fd or negative value to clear
  8217	 *	@chain_map_fd: new chain map fd or negative value to clear
  8218	 *	@flags: xdp-related flags
  8219	 *
  8220	 *	Set or clear a bpf program for a device
  8221	 */
  8222	int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
  8223			      int prog_fd, int chain_map_fd, u32 flags)
  8224	{
  8225		const struct net_device_ops *ops = dev->netdev_ops;
  8226		struct bpf_map *chain_map = NULL;
  8227		enum bpf_netdev_command query;
  8228		struct bpf_prog *prog = NULL;
  8229		bpf_op_t bpf_op, bpf_chk;
  8230		bool offload;
  8231		int err;
  8232	
  8233		ASSERT_RTNL();
  8234	
  8235		offload = flags & XDP_FLAGS_HW_MODE;
  8236		query = offload ? XDP_QUERY_PROG_HW : XDP_QUERY_PROG;
  8237	
  8238		bpf_op = bpf_chk = ops->ndo_bpf;
  8239		if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE))) {
  8240			NL_SET_ERR_MSG(extack, "underlying driver does not support XDP in native mode");
  8241			return -EOPNOTSUPP;
  8242		}
  8243		if (!bpf_op || (flags & XDP_FLAGS_SKB_MODE))
  8244			bpf_op = generic_xdp_install;
  8245		if (bpf_op == bpf_chk)
  8246			bpf_chk = generic_xdp_install;
  8247	
  8248		if (prog_fd >= 0) {
  8249			u32 prog_id;
  8250	
  8251			if (!offload && __dev_xdp_query(dev, bpf_chk, XDP_QUERY_PROG)) {
  8252				NL_SET_ERR_MSG(extack, "native and generic XDP can't be active at the same time");
  8253				return -EEXIST;
  8254			}
  8255	
  8256			prog_id = __dev_xdp_query(dev, bpf_op, query);
  8257			if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) && prog_id) {
  8258				NL_SET_ERR_MSG(extack, "XDP program already attached");
  8259				return -EBUSY;
  8260			}
  8261	
  8262			prog = bpf_prog_get_type_dev(prog_fd, BPF_PROG_TYPE_XDP,
  8263						     bpf_op == ops->ndo_bpf);
  8264			if (IS_ERR(prog))
  8265				return PTR_ERR(prog);
  8266	
  8267			if (!offload && bpf_prog_is_dev_bound(prog->aux)) {
  8268				NL_SET_ERR_MSG(extack, "using device-bound program without HW_MODE flag is not supported");
  8269				bpf_prog_put(prog);
  8270				return -EINVAL;
  8271			}
  8272	
  8273			if (prog->aux->id == prog_id) {
  8274				bpf_prog_put(prog);
  8275				return 0;
  8276			}
  8277		} else {
  8278			if (chain_map_fd >= 0)
  8279				return -EINVAL;
  8280	
  8281			if (!__dev_xdp_query(dev, bpf_op, query))
  8282				return 0;
  8283		}
  8284	
  8285		if (chain_map_fd >= 0) {
> 8286			chain_map = bpf_map_get_with_uref(chain_map_fd);
  8287			if (IS_ERR(chain_map))
  8288				return PTR_ERR(chain_map);
  8289	
  8290			if (chain_map->map_type != BPF_MAP_TYPE_XDP_CHAIN) {
  8291				NL_SET_ERR_MSG(extack, "invalid chain map type");
  8292				bpf_map_put_with_uref(chain_map);
  8293				return -EINVAL;
  8294			}
  8295		}
  8296	
  8297		err = dev_xdp_install(dev, bpf_op, extack, flags, prog);
  8298		if (err < 0) {
  8299			if (prog)
  8300				bpf_prog_put(prog);
  8301		} else {
  8302			rcu_swap_protected(dev->xdp_chain_map, chain_map, 1);
  8303		}
  8304	
  8305		if(chain_map)
  8306			bpf_map_put_with_uref(chain_map);
  8307	
  8308		return err;
  8309	}
  8310	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (19101 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ