Re: [PATCH bpf-next 5/5] bpf: trampoline: support FTRACE_OPS_FL_SHARE_IPMODIFY

From: kernel test robot
Date: Wed Jun 01 2022 - 20:09:07 EST


Hi Song,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url: https://github.com/intel-lab-lkp/linux/commits/Song-Liu/ftrace-host-klp-and-bpf-trampoline-together/20220602-020112
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-a003 (https://download.01.org/0day-ci/archive/20220602/202206020707.jsHlBldB-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/7edcf1c49617641579f2bc36b86c7d59bea20aef
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Song-Liu/ftrace-host-klp-and-bpf-trampoline-together/20220602-020112
git checkout 7edcf1c49617641579f2bc36b86c7d59bea20aef
# 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/trampoline.c:30:66: warning: 'enum ftrace_ops_cmd' declared inside parameter list will not be visible outside of this definition or declaration
30 | static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *op, enum ftrace_ops_cmd cmd);
| ^~~~~~~~~~~~~~
kernel/bpf/trampoline.c: In function 'bpf_trampoline_lookup':
kernel/bpf/trampoline.c:92:35: error: invalid application of 'sizeof' to incomplete type 'struct ftrace_ops'
92 | tr->fops = kzalloc(sizeof(struct ftrace_ops), GFP_KERNEL);
| ^~~~~~
kernel/bpf/trampoline.c:100:17: error: invalid use of undefined type 'struct ftrace_ops'
100 | tr->fops->private = tr;
| ^~
kernel/bpf/trampoline.c:101:17: error: invalid use of undefined type 'struct ftrace_ops'
101 | tr->fops->ops_func = bpf_tramp_ftrace_ops_func;
| ^~
kernel/bpf/trampoline.c: In function 'bpf_trampoline_update':
kernel/bpf/trampoline.c:397:25: error: invalid use of undefined type 'struct ftrace_ops'
397 | tr->fops->flags |= FTRACE_OPS_FL_SHARE_IPMODIFY;
| ^~
kernel/bpf/trampoline.c:397:36: error: 'FTRACE_OPS_FL_SHARE_IPMODIFY' undeclared (first use in this function)
397 | tr->fops->flags |= FTRACE_OPS_FL_SHARE_IPMODIFY;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/trampoline.c:397:36: note: each undeclared identifier is reported only once for each function it appears in
kernel/bpf/trampoline.c:415:25: error: invalid use of undefined type 'struct ftrace_ops'
415 | tr->fops->func = NULL;
| ^~
kernel/bpf/trampoline.c:416:25: error: invalid use of undefined type 'struct ftrace_ops'
416 | tr->fops->trampoline = 0;
| ^~
kernel/bpf/trampoline.c: At top level:
kernel/bpf/trampoline.c:431:67: warning: 'enum ftrace_ops_cmd' declared inside parameter list will not be visible outside of this definition or declaration
431 | static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *ops, enum ftrace_ops_cmd cmd)
| ^~~~~~~~~~~~~~
kernel/bpf/trampoline.c:431:82: error: parameter 2 ('cmd') has incomplete type
431 | static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *ops, enum ftrace_ops_cmd cmd)
| ~~~~~~~~~~~~~~~~~~~~^~~
kernel/bpf/trampoline.c: In function 'bpf_tramp_ftrace_ops_func':
kernel/bpf/trampoline.c:433:40: error: invalid use of undefined type 'struct ftrace_ops'
433 | struct bpf_trampoline *tr = ops->private;
| ^~
kernel/bpf/trampoline.c:448:14: error: 'FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY' undeclared (first use in this function)
448 | case FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY:
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/trampoline.c:452:14: error: 'FTRACE_OPS_CMD_DISABLE_SHARE_IPMODIFY' undeclared (first use in this function)
452 | case FTRACE_OPS_CMD_DISABLE_SHARE_IPMODIFY:
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/trampoline.c:454:25: error: invalid use of undefined type 'struct ftrace_ops'
454 | tr->fops->flags &= ~FTRACE_OPS_FL_SHARE_IPMODIFY;
| ^~
kernel/bpf/trampoline.c:454:37: error: 'FTRACE_OPS_FL_SHARE_IPMODIFY' undeclared (first use in this function)
454 | tr->fops->flags &= ~FTRACE_OPS_FL_SHARE_IPMODIFY;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +30 kernel/bpf/trampoline.c

29
> 30 static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *op, enum ftrace_ops_cmd cmd);
31

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