Re: [PATCH bpf-next 1/6] bpf: add bpf_link support for BPF_NETFILTER programs

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

 



Hi Florian,

kernel test robot noticed the following build errors:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Florian-Westphal/bpf-add-bpf_link-support-for-BPF_NETFILTER-programs/20230406-001447
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20230405161116.13565-2-fw%40strlen.de
patch subject: [PATCH bpf-next 1/6] bpf: add bpf_link support for BPF_NETFILTER programs
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230406/202304061228.XRcVvxoL-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/f373efb623e6ff708403b172fafb506028de6cb8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Florian-Westphal/bpf-add-bpf_link-support-for-BPF_NETFILTER-programs/20230406-001447
        git checkout f373efb623e6ff708403b172fafb506028de6cb8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304061228.XRcVvxoL-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   ld: vmlinux.o: in function `link_create':
>> kernel/bpf/syscall.c:4671: undefined reference to `bpf_nf_link_attach'


vim +4671 kernel/bpf/syscall.c

  4578	
  4579	#define BPF_LINK_CREATE_LAST_FIELD link_create.kprobe_multi.cookies
  4580	static int link_create(union bpf_attr *attr, bpfptr_t uattr)
  4581	{
  4582		enum bpf_prog_type ptype;
  4583		struct bpf_prog *prog;
  4584		int ret;
  4585	
  4586		if (CHECK_ATTR(BPF_LINK_CREATE))
  4587			return -EINVAL;
  4588	
  4589		if (attr->link_create.attach_type == BPF_STRUCT_OPS)
  4590			return bpf_struct_ops_link_create(attr);
  4591	
  4592		prog = bpf_prog_get(attr->link_create.prog_fd);
  4593		if (IS_ERR(prog))
  4594			return PTR_ERR(prog);
  4595	
  4596		ret = bpf_prog_attach_check_attach_type(prog,
  4597							attr->link_create.attach_type);
  4598		if (ret)
  4599			goto out;
  4600	
  4601		switch (prog->type) {
  4602		case BPF_PROG_TYPE_EXT:
  4603		case BPF_PROG_TYPE_NETFILTER:
  4604			break;
  4605		case BPF_PROG_TYPE_PERF_EVENT:
  4606		case BPF_PROG_TYPE_TRACEPOINT:
  4607			if (attr->link_create.attach_type != BPF_PERF_EVENT) {
  4608				ret = -EINVAL;
  4609				goto out;
  4610			}
  4611			break;
  4612		case BPF_PROG_TYPE_KPROBE:
  4613			if (attr->link_create.attach_type != BPF_PERF_EVENT &&
  4614			    attr->link_create.attach_type != BPF_TRACE_KPROBE_MULTI) {
  4615				ret = -EINVAL;
  4616				goto out;
  4617			}
  4618			break;
  4619		default:
  4620			ptype = attach_type_to_prog_type(attr->link_create.attach_type);
  4621			if (ptype == BPF_PROG_TYPE_UNSPEC || ptype != prog->type) {
  4622				ret = -EINVAL;
  4623				goto out;
  4624			}
  4625			break;
  4626		}
  4627	
  4628		switch (prog->type) {
  4629		case BPF_PROG_TYPE_CGROUP_SKB:
  4630		case BPF_PROG_TYPE_CGROUP_SOCK:
  4631		case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
  4632		case BPF_PROG_TYPE_SOCK_OPS:
  4633		case BPF_PROG_TYPE_CGROUP_DEVICE:
  4634		case BPF_PROG_TYPE_CGROUP_SYSCTL:
  4635		case BPF_PROG_TYPE_CGROUP_SOCKOPT:
  4636			ret = cgroup_bpf_link_attach(attr, prog);
  4637			break;
  4638		case BPF_PROG_TYPE_EXT:
  4639			ret = bpf_tracing_prog_attach(prog,
  4640						      attr->link_create.target_fd,
  4641						      attr->link_create.target_btf_id,
  4642						      attr->link_create.tracing.cookie);
  4643			break;
  4644		case BPF_PROG_TYPE_LSM:
  4645		case BPF_PROG_TYPE_TRACING:
  4646			if (attr->link_create.attach_type != prog->expected_attach_type) {
  4647				ret = -EINVAL;
  4648				goto out;
  4649			}
  4650			if (prog->expected_attach_type == BPF_TRACE_RAW_TP)
  4651				ret = bpf_raw_tp_link_attach(prog, NULL);
  4652			else if (prog->expected_attach_type == BPF_TRACE_ITER)
  4653				ret = bpf_iter_link_attach(attr, uattr, prog);
  4654			else if (prog->expected_attach_type == BPF_LSM_CGROUP)
  4655				ret = cgroup_bpf_link_attach(attr, prog);
  4656			else
  4657				ret = bpf_tracing_prog_attach(prog,
  4658							      attr->link_create.target_fd,
  4659							      attr->link_create.target_btf_id,
  4660							      attr->link_create.tracing.cookie);
  4661			break;
  4662		case BPF_PROG_TYPE_FLOW_DISSECTOR:
  4663		case BPF_PROG_TYPE_SK_LOOKUP:
  4664			ret = netns_bpf_link_create(attr, prog);
  4665			break;
  4666	#ifdef CONFIG_NET
  4667		case BPF_PROG_TYPE_XDP:
  4668			ret = bpf_xdp_link_attach(attr, prog);
  4669			break;
  4670		case BPF_PROG_TYPE_NETFILTER:
> 4671			ret = bpf_nf_link_attach(attr, prog);
  4672			break;
  4673	#endif
  4674		case BPF_PROG_TYPE_PERF_EVENT:
  4675		case BPF_PROG_TYPE_TRACEPOINT:
  4676			ret = bpf_perf_link_attach(attr, prog);
  4677			break;
  4678		case BPF_PROG_TYPE_KPROBE:
  4679			if (attr->link_create.attach_type == BPF_PERF_EVENT)
  4680				ret = bpf_perf_link_attach(attr, prog);
  4681			else
  4682				ret = bpf_kprobe_multi_link_attach(attr, prog);
  4683			break;
  4684		default:
  4685			ret = -EINVAL;
  4686		}
  4687	
  4688	out:
  4689		if (ret < 0)
  4690			bpf_prog_put(prog);
  4691		return ret;
  4692	}
  4693	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux