[ammarfaizi2-block:bpf/bpf/master 1/2] kernel/bpf/syscall.c:5089:5: warning: no previous prototype for 'kern_sys_bpf'
From: kernel test robot
Date: Wed Aug 10 2022 - 16:24:45 EST
tree: https://github.com/ammarfaizi2/linux-block bpf/bpf/master
head: 86f44fcec22ce2979507742bc53db8400e454f46
commit: 86f44fcec22ce2979507742bc53db8400e454f46 [1/2] bpf: Disallow bpf programs call prog_run command.
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220811/202208110432.CI0a5IwF-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/ammarfaizi2/linux-block/commit/86f44fcec22ce2979507742bc53db8400e454f46
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block bpf/bpf/master
git checkout 86f44fcec22ce2979507742bc53db8400e454f46
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash kernel/bpf/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> kernel/bpf/syscall.c:5089:5: warning: no previous prototype for 'kern_sys_bpf' [-Wmissing-prototypes]
5089 | int kern_sys_bpf(int cmd, union bpf_attr *attr, unsigned int size)
| ^~~~~~~~~~~~
vim +/kern_sys_bpf +5089 kernel/bpf/syscall.c
5088
> 5089 int kern_sys_bpf(int cmd, union bpf_attr *attr, unsigned int size)
5090 {
5091 struct bpf_prog * __maybe_unused prog;
5092 struct bpf_tramp_run_ctx __maybe_unused run_ctx;
5093
5094 switch (cmd) {
5095 #ifdef CONFIG_BPF_JIT /* __bpf_prog_enter_sleepable used by trampoline and JIT */
5096 case BPF_PROG_TEST_RUN:
5097 if (attr->test.data_in || attr->test.data_out ||
5098 attr->test.ctx_out || attr->test.duration ||
5099 attr->test.repeat || attr->test.flags)
5100 return -EINVAL;
5101
5102 prog = bpf_prog_get_type(attr->test.prog_fd, BPF_PROG_TYPE_SYSCALL);
5103 if (IS_ERR(prog))
5104 return PTR_ERR(prog);
5105
5106 if (attr->test.ctx_size_in < prog->aux->max_ctx_offset ||
5107 attr->test.ctx_size_in > U16_MAX) {
5108 bpf_prog_put(prog);
5109 return -EINVAL;
5110 }
5111
5112 run_ctx.bpf_cookie = 0;
5113 run_ctx.saved_run_ctx = NULL;
5114 if (!__bpf_prog_enter_sleepable(prog, &run_ctx)) {
5115 /* recursion detected */
5116 bpf_prog_put(prog);
5117 return -EBUSY;
5118 }
5119 attr->test.retval = bpf_prog_run(prog, (void *) (long) attr->test.ctx_in);
5120 __bpf_prog_exit_sleepable(prog, 0 /* bpf_prog_run does runtime stats */, &run_ctx);
5121 bpf_prog_put(prog);
5122 return 0;
5123 #endif
5124 default:
5125 return ____bpf_sys_bpf(cmd, attr, size);
5126 }
5127 }
5128 EXPORT_SYMBOL(kern_sys_bpf);
5129
--
0-DAY CI Kernel Test Service
https://01.org/lkp