[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111190116.wPvzIYqv-lkp@intel.com>
Date: Fri, 19 Nov 2021 01:52:27 +0800
From: kernel test robot <lkp@...el.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [jolsa-perf:bpf/batch 18/29] kernel/bpf/syscall.c:2904:2: error:
implicit declaration of function 'bpf_tramp_id_put'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/batch
head: 5f1f613266bf58f8424a93e1f8b99c4ac8fa6c2b
commit: e1bb5d3bd5e9d47950dc214099a56a5efead24fd [18/29] bpf: Add refcount_t to struct bpf_tramp_id
config: hexagon-randconfig-r035-20211118 (attached as .config)
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=e1bb5d3bd5e9d47950dc214099a56a5efead24fd
git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
git fetch --no-tags jolsa-perf bpf/batch
git checkout e1bb5d3bd5e9d47950dc214099a56a5efead24fd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
kernel/bpf/syscall.c:2668:15: error: implicit declaration of function 'bpf_tramp_attach_unlink' [-Werror,-Wimplicit-function-declaration]
WARN_ON_ONCE(bpf_tramp_attach_unlink(attach));
^
kernel/bpf/syscall.c:2672:2: error: implicit declaration of function 'bpf_tramp_detach' [-Werror,-Wimplicit-function-declaration]
bpf_tramp_detach(attach);
^
kernel/bpf/syscall.c:2776:8: error: implicit declaration of function 'bpf_tramp_id_single' [-Werror,-Wimplicit-function-declaration]
id = bpf_tramp_id_single(tgt_prog, prog, btf_id, NULL);
^
kernel/bpf/syscall.c:2776:6: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_id *' from 'int' [-Wint-conversion]
id = bpf_tramp_id_single(tgt_prog, prog, btf_id, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:2831:8: error: implicit declaration of function 'bpf_tramp_id_single' [-Werror,-Wimplicit-function-declaration]
id = bpf_tramp_id_single(NULL, prog, btf_id, NULL);
^
kernel/bpf/syscall.c:2831:6: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_id *' from 'int' [-Wint-conversion]
id = bpf_tramp_id_single(NULL, prog, btf_id, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:2839:8: error: implicit declaration of function 'bpf_tramp_id_is_empty' [-Werror,-Wimplicit-function-declaration]
(!bpf_tramp_id_is_empty(id) &&
^
kernel/bpf/syscall.c:2840:8: error: implicit declaration of function 'bpf_tramp_id_is_equal' [-Werror,-Wimplicit-function-declaration]
bpf_tramp_id_is_equal(id, prog->aux->dst_attach->id))) {
^
kernel/bpf/syscall.c:2840:8: note: did you mean 'bpf_tramp_id_is_empty'?
kernel/bpf/syscall.c:2839:8: note: 'bpf_tramp_id_is_empty' declared here
(!bpf_tramp_id_is_empty(id) &&
^
kernel/bpf/syscall.c:2845:12: error: implicit declaration of function 'bpf_tramp_attach' [-Werror,-Wimplicit-function-declaration]
attach = bpf_tramp_attach(id, tgt_prog, prog);
^
kernel/bpf/syscall.c:2845:10: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_attach *' from 'int' [-Wint-conversion]
attach = bpf_tramp_attach(id, tgt_prog, prog);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:2866:8: error: implicit declaration of function 'bpf_tramp_attach_link' [-Werror,-Wimplicit-function-declaration]
err = bpf_tramp_attach_link(attach);
^
kernel/bpf/syscall.c:2889:3: error: implicit declaration of function 'bpf_tramp_detach' [-Werror,-Wimplicit-function-declaration]
bpf_tramp_detach(prog->aux->dst_attach);
^
>> kernel/bpf/syscall.c:2904:2: error: implicit declaration of function 'bpf_tramp_id_put' [-Werror,-Wimplicit-function-declaration]
bpf_tramp_id_put(id);
^
kernel/bpf/syscall.c:2904:2: note: did you mean 'bpf_trampoline_put'?
include/linux/bpf.h:834:20: note: 'bpf_trampoline_put' declared here
static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
^
3 warnings and 10 errors generated.
--
kernel/bpf/verifier.c:13998:7: error: implicit declaration of function 'bpf_tramp_id_single' [-Werror,-Wimplicit-function-declaration]
id = bpf_tramp_id_single(tgt_prog, prog, btf_id, &tgt_info);
^
kernel/bpf/verifier.c:13998:5: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_id *' from 'int' [-Wint-conversion]
id = bpf_tramp_id_single(tgt_prog, prog, btf_id, &tgt_info);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/verifier.c:14002:11: error: implicit declaration of function 'bpf_tramp_attach' [-Werror,-Wimplicit-function-declaration]
attach = bpf_tramp_attach(id, tgt_prog, prog);
^
kernel/bpf/verifier.c:14002:9: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_attach *' from 'int' [-Wint-conversion]
attach = bpf_tramp_attach(id, tgt_prog, prog);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/verifier.c:14004:3: error: implicit declaration of function 'bpf_tramp_id_put' [-Werror,-Wimplicit-function-declaration]
bpf_tramp_id_put(id);
^
kernel/bpf/verifier.c:14004:3: note: did you mean 'bpf_trampoline_put'?
include/linux/bpf.h:834:20: note: 'bpf_trampoline_put' declared here
static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
^
2 warnings and 3 errors generated.
vim +/bpf_tramp_id_put +2904 kernel/bpf/syscall.c
2718
2719 static int bpf_tracing_prog_attach(struct bpf_prog *prog,
2720 int tgt_prog_fd,
2721 u32 btf_id)
2722 {
2723 bool prog_extension = prog->type == BPF_PROG_TYPE_EXT;
2724 struct bpf_tramp_attach *attach = NULL;
2725 struct bpf_link_primer link_primer;
2726 struct bpf_prog *tgt_prog = NULL;
2727 struct bpf_tracing_link *link;
2728 struct bpf_tramp_id *id = NULL;
2729 int err;
2730
2731 switch (prog->type) {
2732 case BPF_PROG_TYPE_TRACING:
2733 if (prog->expected_attach_type != BPF_TRACE_FENTRY &&
2734 prog->expected_attach_type != BPF_TRACE_FEXIT &&
2735 prog->expected_attach_type != BPF_MODIFY_RETURN) {
2736 err = -EINVAL;
2737 goto out_put_prog;
2738 }
2739 break;
2740 case BPF_PROG_TYPE_EXT:
2741 if (prog->expected_attach_type != 0) {
2742 err = -EINVAL;
2743 goto out_put_prog;
2744 }
2745 break;
2746 case BPF_PROG_TYPE_LSM:
2747 if (prog->expected_attach_type != BPF_LSM_MAC) {
2748 err = -EINVAL;
2749 goto out_put_prog;
2750 }
2751 break;
2752 default:
2753 err = -EINVAL;
2754 goto out_put_prog;
2755 }
2756
2757 if (!!tgt_prog_fd != !!btf_id) {
2758 err = -EINVAL;
2759 goto out_put_prog;
2760 }
2761
2762 if (tgt_prog_fd) {
2763 /* For now we only allow new targets for BPF_PROG_TYPE_EXT */
2764 if (prog->type != BPF_PROG_TYPE_EXT) {
2765 err = -EINVAL;
2766 goto out_put_prog;
2767 }
2768
2769 tgt_prog = bpf_prog_get(tgt_prog_fd);
2770 if (IS_ERR(tgt_prog)) {
2771 err = PTR_ERR(tgt_prog);
2772 tgt_prog = NULL;
2773 goto out_put_prog;
2774 }
2775
2776 id = bpf_tramp_id_single(tgt_prog, prog, btf_id, NULL);
2777 if (IS_ERR(id)) {
2778 err = PTR_ERR(id);
2779 goto out_put_prog;
2780 }
2781 }
2782
2783 link = kzalloc(sizeof(*link), GFP_USER);
2784 if (!link) {
2785 err = -ENOMEM;
2786 goto out_put_prog;
2787 }
2788 bpf_link_init(&link->link, BPF_LINK_TYPE_TRACING,
2789 &bpf_tracing_link_lops, prog);
2790 link->attach_type = prog->expected_attach_type;
2791
2792 mutex_lock(&prog->aux->dst_mutex);
2793
2794 if (!prog_extension && prog->aux->attach) {
2795 err = -EBUSY;
2796 goto out_unlock;
2797 }
2798
2799 /* There are a few possible cases here:
2800 *
2801 * - if prog->aux->dst_trampoline is set, the program was just loaded
2802 * and not yet attached to anything, so we can use the values stored
2803 * in prog->aux
2804 *
2805 * - if prog->aux->dst_trampoline is NULL, the program has already been
2806 * attached to a target and its initial target was cleared (below)
2807 *
2808 * - if tgt_prog != NULL, the caller specified tgt_prog_fd +
2809 * target_btf_id using the link_create API.
2810 *
2811 * - if tgt_prog == NULL when this function was called using the old
2812 * raw_tracepoint_open API, and we need a target from prog->aux
2813 *
2814 * - if prog->aux->dst_trampoline and tgt_prog is NULL, the program
2815 * was detached and is going for re-attachment.
2816 */
2817 if (!prog->aux->dst_attach && !tgt_prog) {
2818 /*
2819 * Allow re-attach for TRACING and LSM programs. If it's
2820 * currently linked, bpf_trampoline_link_prog will fail.
2821 * EXT programs need to specify tgt_prog_fd, so they
2822 * re-attach in separate code path.
2823 */
2824 if (prog->type != BPF_PROG_TYPE_TRACING &&
2825 prog->type != BPF_PROG_TYPE_LSM) {
2826 err = -EINVAL;
2827 goto out_unlock;
2828 }
2829
2830 btf_id = prog->aux->attach_btf_id;
2831 id = bpf_tramp_id_single(NULL, prog, btf_id, NULL);
2832 if (IS_ERR(id)) {
2833 err = PTR_ERR(id);
2834 goto out_unlock;
2835 }
2836 }
2837
2838 if (!prog->aux->dst_attach ||
2839 (!bpf_tramp_id_is_empty(id) &&
2840 bpf_tramp_id_is_equal(id, prog->aux->dst_attach->id))) {
2841 /* If there is no saved target, or the specified target is
2842 * different from the destination specified at load time, we
2843 * need a new trampoline and a check for compatibility
2844 */
2845 attach = bpf_tramp_attach(id, tgt_prog, prog);
2846 if (IS_ERR(attach)) {
2847 err = PTR_ERR(attach);
2848 goto out_unlock;
2849 }
2850 } else {
2851 /* The caller didn't specify a target, or the target was the
2852 * same as the destination supplied during program load. This
2853 * means we can reuse the trampoline and reference from program
2854 * load time, and there is no need to allocate a new one. This
2855 * can only happen once for any program, as the saved values in
2856 * prog->aux are cleared below.
2857 */
2858 attach = prog->aux->dst_attach;
2859 tgt_prog = prog->aux->dst_prog;
2860 }
2861
2862 err = bpf_link_prime(&link->link, &link_primer);
2863 if (err)
2864 goto out_unlock;
2865
2866 err = bpf_tramp_attach_link(attach);
2867 if (err) {
2868 bpf_link_cleanup(&link_primer);
2869 link = NULL;
2870 goto out_unlock;
2871 }
2872
2873 link->tgt_prog = tgt_prog;
2874 if (prog_extension)
2875 link->attach = attach;
2876 else
2877 prog->aux->attach = attach;
2878
2879 /* Always clear the trampoline and target prog from prog->aux to make
2880 * sure the original attach destination is not kept alive after a
2881 * program is (re-)attached to another target.
2882 */
2883 if (prog->aux->dst_prog &&
2884 (tgt_prog_fd || attach != prog->aux->dst_attach))
2885 /* got extra prog ref from syscall, or attaching to different prog */
2886 bpf_prog_put(prog->aux->dst_prog);
2887 if (prog->aux->dst_attach && attach != prog->aux->dst_attach)
2888 /* we allocated a new trampoline, so free the old one */
2889 bpf_tramp_detach(prog->aux->dst_attach);
2890
2891 prog->aux->dst_prog = NULL;
2892 prog->aux->dst_attach = NULL;
2893 mutex_unlock(&prog->aux->dst_mutex);
2894
2895 return bpf_link_settle(&link_primer);
2896 out_unlock:
2897 if (attach && attach != prog->aux->dst_attach)
2898 bpf_tramp_detach(attach);
2899 mutex_unlock(&prog->aux->dst_mutex);
2900 kfree(link);
2901 out_put_prog:
2902 if (tgt_prog_fd && tgt_prog)
2903 bpf_prog_put(tgt_prog);
> 2904 bpf_tramp_id_put(id);
2905 return err;
2906 }
2907
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (23348 bytes)
Powered by blists - more mailing lists