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>] [day] [month] [year] [list]
Date:   Fri, 14 Oct 2022 06:54:52 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jolsa-perf:bpf/tracing_multi_ng_4 17/23]
 kernel/bpf/syscall.c:2532:22: error: implicit declaration of function
 'is_tracing_multi'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/tracing_multi_ng_4
head:   e3fa3b908cc734f85477c07a0ba93480bd80702c
commit: a7dd4849b69b1d55ca2feeb526c5533bbc1f43e0 [17/23] bpf: Add multi tracing attach types
config: arc-randconfig-r043-20221013
compiler: arceb-elf-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://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id=a7dd4849b69b1d55ca2feeb526c5533bbc1f43e0
        git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
        git fetch --no-tags jolsa-perf bpf/tracing_multi_ng_4
        git checkout a7dd4849b69b1d55ca2feeb526c5533bbc1f43e0
        # 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=arc SHELL=/bin/bash kernel/bpf/

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

All errors (new ones prefixed by >>):

   kernel/bpf/syscall.c: In function 'bpf_prog_load':
>> kernel/bpf/syscall.c:2532:22: error: implicit declaration of function 'is_tracing_multi' [-Werror=implicit-function-declaration]
    2532 |         multi_func = is_tracing_multi(attr->expected_attach_type);
         |                      ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   kernel/bpf/verifier.c: In function 'check_attach_btf_id':
>> kernel/bpf/verifier.c:15132:20: error: implicit declaration of function 'is_tracing_multi' [-Werror=implicit-function-declaration]
   15132 |         } else if (is_tracing_multi(prog->expected_attach_type))
         |                    ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/is_tracing_multi +2532 kernel/bpf/syscall.c

  2482	
  2483	static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr)
  2484	{
  2485		enum bpf_prog_type type = attr->prog_type;
  2486		struct bpf_prog *prog, *dst_prog = NULL;
  2487		struct btf *attach_btf = NULL;
  2488		int err;
  2489		char license[128];
  2490		bool multi_func;
  2491		bool is_gpl;
  2492	
  2493		if (CHECK_ATTR(BPF_PROG_LOAD))
  2494			return -EINVAL;
  2495	
  2496		if (attr->prog_flags & ~(BPF_F_STRICT_ALIGNMENT |
  2497					 BPF_F_ANY_ALIGNMENT |
  2498					 BPF_F_TEST_STATE_FREQ |
  2499					 BPF_F_SLEEPABLE |
  2500					 BPF_F_TEST_RND_HI32 |
  2501					 BPF_F_XDP_HAS_FRAGS))
  2502			return -EINVAL;
  2503	
  2504		if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) &&
  2505		    (attr->prog_flags & BPF_F_ANY_ALIGNMENT) &&
  2506		    !bpf_capable())
  2507			return -EPERM;
  2508	
  2509		/* copy eBPF program license from user space */
  2510		if (strncpy_from_bpfptr(license,
  2511					make_bpfptr(attr->license, uattr.is_kernel),
  2512					sizeof(license) - 1) < 0)
  2513			return -EFAULT;
  2514		license[sizeof(license) - 1] = 0;
  2515	
  2516		/* eBPF programs must be GPL compatible to use GPL-ed functions */
  2517		is_gpl = license_is_gpl_compatible(license);
  2518	
  2519		if (attr->insn_cnt == 0 ||
  2520		    attr->insn_cnt > (bpf_capable() ? BPF_COMPLEXITY_LIMIT_INSNS : BPF_MAXINSNS))
  2521			return -E2BIG;
  2522		if (type != BPF_PROG_TYPE_SOCKET_FILTER &&
  2523		    type != BPF_PROG_TYPE_CGROUP_SKB &&
  2524		    !bpf_capable())
  2525			return -EPERM;
  2526	
  2527		if (is_net_admin_prog_type(type) && !capable(CAP_NET_ADMIN) && !capable(CAP_SYS_ADMIN))
  2528			return -EPERM;
  2529		if (is_perfmon_prog_type(type) && !perfmon_capable())
  2530			return -EPERM;
  2531	
> 2532		multi_func = is_tracing_multi(attr->expected_attach_type);
  2533	
  2534		/* attach_prog_fd/attach_btf_obj_fd can specify fd of either bpf_prog
  2535		 * or btf, we need to check which one it is
  2536		 */
  2537		if (attr->attach_prog_fd) {
  2538			dst_prog = bpf_prog_get(attr->attach_prog_fd);
  2539			if (IS_ERR(dst_prog)) {
  2540				dst_prog = NULL;
  2541				attach_btf = btf_get_by_fd(attr->attach_btf_obj_fd);
  2542				if (IS_ERR(attach_btf))
  2543					return -EINVAL;
  2544				if (!btf_is_kernel(attach_btf)) {
  2545					/* attaching through specifying bpf_prog's BTF
  2546					 * objects directly might be supported eventually
  2547					 */
  2548					btf_put(attach_btf);
  2549					return -ENOTSUPP;
  2550				}
  2551			}
  2552		} else if (attr->attach_btf_id || multi_func) {
  2553			/* fall back to vmlinux BTF, if BTF type ID is specified */
  2554			attach_btf = bpf_get_btf_vmlinux();
  2555			if (IS_ERR(attach_btf))
  2556				return PTR_ERR(attach_btf);
  2557			if (!attach_btf)
  2558				return -EINVAL;
  2559			btf_get(attach_btf);
  2560		}
  2561	
  2562		bpf_prog_load_fixup_attach_type(attr);
  2563		if (bpf_prog_load_check_attach(type, attr->expected_attach_type,
  2564					       attach_btf, attr->attach_btf_id,
  2565					       dst_prog, multi_func)) {
  2566			if (dst_prog)
  2567				bpf_prog_put(dst_prog);
  2568			if (attach_btf)
  2569				btf_put(attach_btf);
  2570			return -EINVAL;
  2571		}
  2572	
  2573		/* plain bpf_prog allocation */
  2574		prog = bpf_prog_alloc(bpf_prog_size(attr->insn_cnt), GFP_USER);
  2575		if (!prog) {
  2576			if (dst_prog)
  2577				bpf_prog_put(dst_prog);
  2578			if (attach_btf)
  2579				btf_put(attach_btf);
  2580			return -ENOMEM;
  2581		}
  2582	
  2583		prog->expected_attach_type = attr->expected_attach_type;
  2584		prog->aux->attach_btf = attach_btf;
  2585		prog->aux->attach_btf_id = multi_func ? bpf_multi_func_btf_id[0] : attr->attach_btf_id;
  2586		prog->aux->dst_prog = dst_prog;
  2587		prog->aux->offload_requested = !!attr->prog_ifindex;
  2588		prog->aux->sleepable = attr->prog_flags & BPF_F_SLEEPABLE;
  2589		prog->aux->xdp_has_frags = attr->prog_flags & BPF_F_XDP_HAS_FRAGS;
  2590	
  2591		err = security_bpf_prog_alloc(prog->aux);
  2592		if (err)
  2593			goto free_prog;
  2594	
  2595		prog->aux->user = get_current_user();
  2596		prog->len = attr->insn_cnt;
  2597	
  2598		err = -EFAULT;
  2599		if (copy_from_bpfptr(prog->insns,
  2600				     make_bpfptr(attr->insns, uattr.is_kernel),
  2601				     bpf_prog_insn_size(prog)) != 0)
  2602			goto free_prog_sec;
  2603	
  2604		prog->orig_prog = NULL;
  2605		prog->jited = 0;
  2606	
  2607		atomic64_set(&prog->aux->refcnt, 1);
  2608		prog->gpl_compatible = is_gpl ? 1 : 0;
  2609	
  2610		if (bpf_prog_is_dev_bound(prog->aux)) {
  2611			err = bpf_prog_offload_init(prog, attr);
  2612			if (err)
  2613				goto free_prog_sec;
  2614		}
  2615	
  2616		/* find program type: socket_filter vs tracing_filter */
  2617		err = find_prog_type(type, prog);
  2618		if (err < 0)
  2619			goto free_prog_sec;
  2620	
  2621		prog->aux->load_time = ktime_get_boottime_ns();
  2622		err = bpf_obj_name_cpy(prog->aux->name, attr->prog_name,
  2623				       sizeof(attr->prog_name));
  2624		if (err < 0)
  2625			goto free_prog_sec;
  2626	
  2627		/* run eBPF verifier */
  2628		err = bpf_check(&prog, attr, uattr);
  2629		if (err < 0)
  2630			goto free_used_maps;
  2631	
  2632		prog = bpf_prog_select_runtime(prog, &err);
  2633		if (err < 0)
  2634			goto free_used_maps;
  2635	
  2636		err = bpf_prog_alloc_id(prog);
  2637		if (err)
  2638			goto free_used_maps;
  2639	
  2640		/* Upon success of bpf_prog_alloc_id(), the BPF prog is
  2641		 * effectively publicly exposed. However, retrieving via
  2642		 * bpf_prog_get_fd_by_id() will take another reference,
  2643		 * therefore it cannot be gone underneath us.
  2644		 *
  2645		 * Only for the time /after/ successful bpf_prog_new_fd()
  2646		 * and before returning to userspace, we might just hold
  2647		 * one reference and any parallel close on that fd could
  2648		 * rip everything out. Hence, below notifications must
  2649		 * happen before bpf_prog_new_fd().
  2650		 *
  2651		 * Also, any failure handling from this point onwards must
  2652		 * be using bpf_prog_put() given the program is exposed.
  2653		 */
  2654		bpf_prog_kallsyms_add(prog);
  2655		perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_LOAD, 0);
  2656		bpf_audit_prog(prog, BPF_AUDIT_LOAD);
  2657	
  2658		err = bpf_prog_new_fd(prog);
  2659		if (err < 0)
  2660			bpf_prog_put(prog);
  2661		return err;
  2662	
  2663	free_used_maps:
  2664		/* In case we have subprogs, we need to wait for a grace
  2665		 * period before we can tear down JIT memory since symbols
  2666		 * are already exposed under kallsyms.
  2667		 */
  2668		__bpf_prog_put_noref(prog, prog->aux->func_cnt);
  2669		return err;
  2670	free_prog_sec:
  2671		free_uid(prog->aux->user);
  2672		security_bpf_prog_free(prog->aux);
  2673	free_prog:
  2674		if (prog->aux->attach_btf)
  2675			btf_put(prog->aux->attach_btf);
  2676		bpf_prog_free(prog);
  2677		return err;
  2678	}
  2679	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (149754 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ