Messages in this thread | | | Date | Thu, 18 Nov 2021 22:34:32 +0800 | From | kernel test robot <> | Subject | [jolsa-perf:bpf/batch 10/29] kernel/bpf/syscall.c:2769:8: error: implicit declaration of function 'bpf_tramp_id_alloc' |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/batch head: 5f1f613266bf58f8424a93e1f8b99c4ac8fa6c2b commit: cbe393beb391564c3571b19dc56e28873904f48e [10/29] bpf: Add bpf_trampoline_id object 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=cbe393beb391564c3571b19dc56e28873904f48e 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 cbe393beb391564c3571b19dc56e28873904f48e # 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@intel.com>
All error/warnings (new ones prefixed by >>):
>> kernel/bpf/syscall.c:2769:8: error: implicit declaration of function 'bpf_tramp_id_alloc' [-Werror,-Wimplicit-function-declaration] id = bpf_tramp_id_alloc(); ^ kernel/bpf/syscall.c:2769:8: note: did you mean 'bpf_map_kzalloc'? kernel/bpf/syscall.c:425:7: note: 'bpf_map_kzalloc' declared here void *bpf_map_kzalloc(const struct bpf_map *map, size_t size, gfp_t flags) ^ >> kernel/bpf/syscall.c:2769:6: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_id *' from 'int' [-Wint-conversion] id = bpf_tramp_id_alloc(); ^ ~~~~~~~~~~~~~~~~~~~~ kernel/bpf/syscall.c:2782:3: error: implicit declaration of function 'bpf_tramp_id_init' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_init(id, tgt_prog, NULL, btf_id); ^ kernel/bpf/syscall.c:2782:3: note: did you mean 'bpf_tramp_id_alloc'? kernel/bpf/syscall.c:2769:8: note: 'bpf_tramp_id_alloc' declared here id = bpf_tramp_id_alloc(); ^ kernel/bpf/syscall.c:2832:8: error: implicit declaration of function 'bpf_tramp_id_alloc' [-Werror,-Wimplicit-function-declaration] id = bpf_tramp_id_alloc(); ^ kernel/bpf/syscall.c:2832:6: warning: incompatible integer to pointer conversion assigning to 'struct bpf_tramp_id *' from 'int' [-Wint-conversion] id = bpf_tramp_id_alloc(); ^ ~~~~~~~~~~~~~~~~~~~~ kernel/bpf/syscall.c:2839:3: error: implicit declaration of function 'bpf_tramp_id_init' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_init(id, NULL, prog->aux->attach_btf, btf_id); ^ >> kernel/bpf/syscall.c:2843: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:2844:8: error: implicit declaration of function 'bpf_tramp_id_is_equal' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_is_equal(id, prog->aux->dst_trampoline->id))) { ^ kernel/bpf/syscall.c:2844:8: note: did you mean 'bpf_tramp_id_is_empty'? kernel/bpf/syscall.c:2843:8: note: 'bpf_tramp_id_is_empty' declared here (!bpf_tramp_id_is_empty(id) && ^ kernel/bpf/syscall.c:2916:2: error: implicit declaration of function 'bpf_tramp_id_free' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_free(id); ^ 2 warnings and 7 errors generated. -- kernel/bpf/verifier.c:13998:7: error: implicit declaration of function 'bpf_tramp_id_alloc' [-Werror,-Wimplicit-function-declaration] id = bpf_tramp_id_alloc(); ^ kernel/bpf/verifier.c:13998:7: note: did you mean 'bpf_map_kzalloc'? include/linux/bpf.h:1457:7: note: 'bpf_map_kzalloc' declared here void *bpf_map_kzalloc(const struct bpf_map *map, size_t size, gfp_t flags); ^ >> 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_alloc(); ^ ~~~~~~~~~~~~~~~~~~~~ kernel/bpf/verifier.c:14002:2: error: implicit declaration of function 'bpf_tramp_id_init' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_init(id, tgt_prog, prog->aux->attach_btf, btf_id); ^ kernel/bpf/verifier.c:14002:2: note: did you mean 'bpf_tramp_id_alloc'? kernel/bpf/verifier.c:13998:7: note: 'bpf_tramp_id_alloc' declared here id = bpf_tramp_id_alloc(); ^ kernel/bpf/verifier.c:14005:3: error: implicit declaration of function 'bpf_tramp_id_free' [-Werror,-Wimplicit-function-declaration] bpf_tramp_id_free(id); ^ kernel/bpf/verifier.c:14005:3: note: did you mean 'bpf_tramp_id_init'? kernel/bpf/verifier.c:14002:2: note: 'bpf_tramp_id_init' declared here bpf_tramp_id_init(id, tgt_prog, prog->aux->attach_btf, btf_id); ^ 1 warning and 3 errors generated.
vim +/bpf_tramp_id_alloc +2769 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_link_primer link_primer; 2725 struct bpf_prog *tgt_prog = NULL; 2726 struct bpf_trampoline *tr = 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 id = bpf_tramp_id_alloc(); 2770 if (!id) { 2771 err = -ENOMEM; 2772 goto out_put_prog; 2773 } 2774 2775 tgt_prog = bpf_prog_get(tgt_prog_fd); 2776 if (IS_ERR(tgt_prog)) { 2777 err = PTR_ERR(tgt_prog); 2778 tgt_prog = NULL; 2779 goto out_put_prog; 2780 } 2781 2782 bpf_tramp_id_init(id, tgt_prog, NULL, btf_id); 2783 } 2784 2785 link = kzalloc(sizeof(*link), GFP_USER); 2786 if (!link) { 2787 err = -ENOMEM; 2788 goto out_put_prog; 2789 } 2790 bpf_link_init(&link->link, BPF_LINK_TYPE_TRACING, 2791 &bpf_tracing_link_lops, prog); 2792 link->attach_type = prog->expected_attach_type; 2793 2794 mutex_lock(&prog->aux->dst_mutex); 2795 2796 if (!prog_extension && prog->aux->trampoline) { 2797 err = -EBUSY; 2798 goto out_unlock; 2799 } 2800 2801 /* There are a few possible cases here: 2802 * 2803 * - if prog->aux->dst_trampoline is set, the program was just loaded 2804 * and not yet attached to anything, so we can use the values stored 2805 * in prog->aux 2806 * 2807 * - if prog->aux->dst_trampoline is NULL, the program has already been 2808 * attached to a target and its initial target was cleared (below) 2809 * 2810 * - if tgt_prog != NULL, the caller specified tgt_prog_fd + 2811 * target_btf_id using the link_create API. 2812 * 2813 * - if tgt_prog == NULL when this function was called using the old 2814 * raw_tracepoint_open API, and we need a target from prog->aux 2815 * 2816 * - if prog->aux->dst_trampoline and tgt_prog is NULL, the program 2817 * was detached and is going for re-attachment. 2818 */ 2819 if (!prog->aux->dst_trampoline && !tgt_prog) { 2820 /* 2821 * Allow re-attach for TRACING and LSM programs. If it's 2822 * currently linked, bpf_trampoline_link_prog will fail. 2823 * EXT programs need to specify tgt_prog_fd, so they 2824 * re-attach in separate code path. 2825 */ 2826 if (prog->type != BPF_PROG_TYPE_TRACING && 2827 prog->type != BPF_PROG_TYPE_LSM) { 2828 err = -EINVAL; 2829 goto out_unlock; 2830 } 2831 2832 id = bpf_tramp_id_alloc(); 2833 if (!id) { 2834 err = -ENOMEM; 2835 goto out_unlock; 2836 } 2837 2838 btf_id = prog->aux->attach_btf_id; 2839 bpf_tramp_id_init(id, NULL, prog->aux->attach_btf, btf_id); 2840 } 2841 2842 if (!prog->aux->dst_trampoline || > 2843 (!bpf_tramp_id_is_empty(id) && > 2844 bpf_tramp_id_is_equal(id, prog->aux->dst_trampoline->id))) { 2845 /* If there is no saved target, or the specified target is 2846 * different from the destination specified at load time, we 2847 * need a new trampoline and a check for compatibility 2848 */ 2849 struct bpf_attach_target_info tgt_info = {}; 2850 2851 err = bpf_check_attach_target(NULL, prog, tgt_prog, btf_id, 2852 &tgt_info); 2853 if (err) 2854 goto out_unlock; 2855 2856 tr = bpf_trampoline_get(id, &tgt_info); 2857 if (!tr) { 2858 err = -ENOMEM; 2859 goto out_unlock; 2860 } 2861 } else { 2862 /* The caller didn't specify a target, or the target was the 2863 * same as the destination supplied during program load. This 2864 * means we can reuse the trampoline and reference from program 2865 * load time, and there is no need to allocate a new one. This 2866 * can only happen once for any program, as the saved values in 2867 * prog->aux are cleared below. 2868 */ 2869 tr = prog->aux->dst_trampoline; 2870 tgt_prog = prog->aux->dst_prog; 2871 } 2872 2873 err = bpf_link_prime(&link->link, &link_primer); 2874 if (err) 2875 goto out_unlock; 2876 2877 err = bpf_trampoline_link_prog(prog, tr); 2878 if (err) { 2879 bpf_link_cleanup(&link_primer); 2880 link = NULL; 2881 goto out_unlock; 2882 } 2883 2884 link->tgt_prog = tgt_prog; 2885 2886 if (prog_extension) 2887 link->trampoline = tr; 2888 else 2889 prog->aux->trampoline = tr; 2890 2891 /* Always clear the trampoline and target prog from prog->aux to make 2892 * sure the original attach destination is not kept alive after a 2893 * program is (re-)attached to another target. 2894 */ 2895 if (prog->aux->dst_prog && 2896 (tgt_prog_fd || tr != prog->aux->dst_trampoline)) 2897 /* got extra prog ref from syscall, or attaching to different prog */ 2898 bpf_prog_put(prog->aux->dst_prog); 2899 if (prog->aux->dst_trampoline && tr != prog->aux->dst_trampoline) 2900 /* we allocated a new trampoline, so free the old one */ 2901 bpf_trampoline_put(prog->aux->dst_trampoline); 2902 2903 prog->aux->dst_prog = NULL; 2904 prog->aux->dst_trampoline = NULL; 2905 mutex_unlock(&prog->aux->dst_mutex); 2906 2907 return bpf_link_settle(&link_primer); 2908 out_unlock: 2909 if (tr && tr != prog->aux->dst_trampoline) 2910 bpf_trampoline_put(tr); 2911 mutex_unlock(&prog->aux->dst_mutex); 2912 kfree(link); 2913 out_put_prog: 2914 if (tgt_prog_fd && tgt_prog) 2915 bpf_prog_put(tgt_prog); 2916 bpf_tramp_id_free(id); 2917 return err; 2918 } 2919
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |