tree:
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/attach
head: 309b598ba309017a35c6659304b00395d39c0ecb
commit: 74674c0d67be89d274546c46f8715315099c2b9d [13/18] bpf: Add
BPF_TRAMPOLINE_BATCH_ATTACH support
config: x86_64-randconfig-p001-20201018 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
#
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id...
git remote add jolsa-perf
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
git fetch --no-tags jolsa-perf bpf/attach
git checkout 74674c0d67be89d274546c46f8715315099c2b9d
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
kernel/bpf/syscall.c: In function 'bpf_trampoline_batch':
> kernel/bpf/syscall.c:2919:10: error: implicit declaration of
function 'bpf_trampoline_batch_alloc'; did you mean
'bpf_trampoline_batch'? [-Werror=implicit-function-declaration]
2919 |
batch = bpf_trampoline_batch_alloc(count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| bpf_trampoline_batch
> kernel/bpf/syscall.c:2919:8: warning: assignment to 'struct
bpf_trampoline_batch *' from 'int' makes pointer from integer without a cast
[-Wint-conversion]
2919 | batch = bpf_trampoline_batch_alloc(count);
| ^
> kernel/bpf/syscall.c:2946:8: error: implicit declaration of
function 'register_ftrace_direct_ips'; did you mean
'register_ftrace_direct'? [-Werror=implicit-function-declaration]
2946 |
ret = register_ftrace_direct_ips(batch->ips, batch->addrs, batch->idx);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| register_ftrace_direct
> kernel/bpf/syscall.c:2951:2: error: implicit declaration of
function 'bpf_trampoline_batch_free'; did you mean 'bpf_trampoline_batch'?
[-Werror=implicit-function-declaration]
2951 |
bpf_trampoline_batch_free(batch);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| bpf_trampoline_batch
cc1: some warnings being treated as errors
vim +2919 kernel/bpf/syscall.c
2884
2885 static int bpf_trampoline_batch(const union bpf_attr *attr, int cmd)
2886 {
2887 void __user *uout = u64_to_user_ptr(attr->trampoline_batch.out);
2888 void __user *uin = u64_to_user_ptr(attr->trampoline_batch.in);
2889 struct bpf_trampoline_batch *batch = NULL;
2890 struct bpf_prog *prog;
2891 int count, ret, i, fd;
2892 u32 *in, *out;
2893
2894 if (CHECK_ATTR(BPF_RAW_TRACEPOINT_OPEN_BATCH))
2895 return -EINVAL;
2896
2897 if (!uin || !uout)
2898 return -EINVAL;
2899
2900 count = attr->trampoline_batch.count;
2901
2902 in = kcalloc(count, sizeof(u32), GFP_KERNEL);
2903 out = kcalloc(count, sizeof(u32), GFP_KERNEL);
2904 if (!in || !out) {
2905 kfree(in);
2906 kfree(out);
2907 return -ENOMEM;
2908 }
2909
2910 ret = copy_from_user(in, uin, count * sizeof(u32));
2911 if (ret)
2912 goto out_clean;
2913
2914 /* test read out array */
2915 ret = copy_to_user(uout, out, count * sizeof(u32));
2916 if (ret)
2917 goto out_clean;
2918
2919 batch = bpf_trampoline_batch_alloc(count);
2920 if
(!batch)
2921 goto out_clean;
2922
2923 for (i = 0; i < count; i++) {
2924 if (cmd == BPF_TRAMPOLINE_BATCH_ATTACH) {
2925 prog = bpf_prog_get(in[i]);
2926 if (IS_ERR(prog)) {
2927 ret = PTR_ERR(prog);
2928 goto out_clean;
2929 }
2930
2931 ret = -EINVAL;
2932 if (prog->type != BPF_PROG_TYPE_TRACING)
2933 goto out_clean;
2934 if (prog->type == BPF_PROG_TYPE_TRACING &&
2935 prog->expected_attach_type == BPF_TRACE_RAW_TP)
2936 goto out_clean;
2937
2938 fd = bpf_tracing_prog_attach(prog, 0, 0, batch);
2939 if (fd < 0)
2940 goto out_clean;
2941
2942 out[i] = fd;
2943 }
2944 }
2945
2946 ret = register_ftrace_direct_ips(batch->ips,
batch->addrs, batch->idx);
2947 if (!ret)
2948 WARN_ON_ONCE(copy_to_user(uout, out, count * sizeof(u32)));
2949
2950 out_clean:
2951 bpf_trampoline_batch_free(batch);
2952 kfree(in);
2953 kfree(out);
2954 return ret;
2955 }
2956
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org