[mhiramat:kprobes/kretprobe-stackfix-v9 14/22] arch/x86/kernel/kprobes/core.c:1061:1: warning: data definition has no type or storage class
From: kernel test robot
Date: Sun Jul 11 2021 - 17:20:55 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git kprobes/kretprobe-stackfix-v9
head: 7a69e2b70adeabbf3e3c1be8a18b43188c4d085d
commit: e4d6ef1b03f84257031acd58c208dd0ffa92548c [14/22] x86/kprobes: Add UNWIND_HINT_FUNC on kretprobe_trampoline()
config: i386-randconfig-a002-20210712 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/commit/?id=e4d6ef1b03f84257031acd58c208dd0ffa92548c
git remote add mhiramat https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git
git fetch --no-tags mhiramat kprobes/kretprobe-stackfix-v9
git checkout e4d6ef1b03f84257031acd58c208dd0ffa92548c
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/kprobes/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/kprobes/core.c:1061:1: warning: data definition has no type or storage class
1061 | STACK_FRAME_NON_STANDARD_FP(__kretprobe_trampoline);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/kprobes/core.c:1061:1: error: type defaults to 'int' in declaration of 'STACK_FRAME_NON_STANDARD_FP' [-Werror=implicit-int]
>> arch/x86/kernel/kprobes/core.c:1061:1: warning: parameter names (without types) in function declaration
arch/x86/kernel/kprobes/core.c:1066:24: warning: no previous prototype for 'trampoline_handler' [-Wmissing-prototypes]
1066 | __used __visible void *trampoline_handler(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +1061 arch/x86/kernel/kprobes/core.c
1015
1016 /*
1017 * When a retprobed function returns, this code saves registers and
1018 * calls trampoline_handler() runs, which calls the kretprobe's handler.
1019 */
1020 asm(
1021 ".text\n"
1022 ".global __kretprobe_trampoline\n"
1023 ".type __kretprobe_trampoline, @function\n"
1024 "__kretprobe_trampoline:\n"
1025 /* We don't bother saving the ss register */
1026 #ifdef CONFIG_X86_64
1027 " pushq %rsp\n"
1028 UNWIND_HINT_FUNC
1029 " pushfq\n"
1030 SAVE_REGS_STRING
1031 " movq %rsp, %rdi\n"
1032 " call trampoline_handler\n"
1033 /* Replace saved sp with true return address. */
1034 " movq %rax, 19*8(%rsp)\n"
1035 RESTORE_REGS_STRING
1036 " popfq\n"
1037 #else
1038 " pushl %esp\n"
1039 UNWIND_HINT_FUNC
1040 " pushfl\n"
1041 SAVE_REGS_STRING
1042 " movl %esp, %eax\n"
1043 " call trampoline_handler\n"
1044 /* Replace saved sp with true return address. */
1045 " movl %eax, 15*4(%esp)\n"
1046 RESTORE_REGS_STRING
1047 " popfl\n"
1048 #endif
1049 " ret\n"
1050 ".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
1051 );
1052 NOKPROBE_SYMBOL(__kretprobe_trampoline);
1053 /*
1054 * __kretprobe_trampoline() skips updating frame pointer. The frame pointer
1055 * saved in trampoline_handler() points to the real caller function's
1056 * frame pointer. Thus the __kretprobe_trampoline() doesn't have a
1057 * standard stack frame with CONFIG_FRAME_POINTER=y.
1058 * Let's mark it non-standard function. Anyway, FP unwinder can correctly
1059 * unwind without the hint.
1060 */
> 1061 STACK_FRAME_NON_STANDARD_FP(__kretprobe_trampoline);
1062
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip