Re: [PATCH 2/2] kprobes: Mark ftrace mcount handler functions nokprobe

From: kbuild test robot
Date: Mon Jan 07 2019 - 12:40:04 EST


Hi Masami,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0-rc1 next-20190107]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Masami-Hiramatsu/kprobes-Fix-kretprobe-incorrect-stacking-order-problem/20190108-003448
config: i386-randconfig-s3-201901 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

kernel/trace/ftrace.c:6219:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
static nokprobe_inline void
^~~~
kernel/trace/ftrace.c: In function 'ftrace_ops_list_func':
>> kernel/trace/ftrace.c:6277:2: error: implicit declaration of function '__ftrace_ops_list_func' [-Werror=implicit-function-declaration]
__ftrace_ops_list_func(ip, parent_ip, NULL, regs);
^~~~~~~~~~~~~~~~~~~~~~
kernel/trace/ftrace.c: At top level:
kernel/trace/ftrace.c:6279:1: warning: data definition has no type or storage class
NOKPROBE_SYMBOL(ftrace_ops_list_func);
^~~~~~~~~~~~~~~
kernel/trace/ftrace.c:6279:1: error: type defaults to 'int' in declaration of 'NOKPROBE_SYMBOL' [-Werror=implicit-int]
kernel/trace/ftrace.c:6279:1: warning: parameter names (without types) in function declaration
kernel/trace/ftrace.c:6312:1: warning: data definition has no type or storage class
NOKPROBE_SYMBOL(ftrace_ops_assist_func);
^~~~~~~~~~~~~~~
kernel/trace/ftrace.c:6312:1: error: type defaults to 'int' in declaration of 'NOKPROBE_SYMBOL' [-Werror=implicit-int]
kernel/trace/ftrace.c:6312:1: warning: parameter names (without types) in function declaration
cc1: some warnings being treated as errors

vim +/__ftrace_ops_list_func +6277 kernel/trace/ftrace.c

4104d326 Steven Rostedt (Red Hat 2014-01-10 6218)
0b5a8971 Masami Hiramatsu 2019-01-07 @6219 static nokprobe_inline void
2f5f6ad9 Steven Rostedt 2011-08-08 6220 __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
a1e2e31d Steven Rostedt 2011-08-09 6221 struct ftrace_ops *ignored, struct pt_regs *regs)
b848914c Steven Rostedt 2011-05-04 6222 {
cdbe61bf Steven Rostedt 2011-05-05 6223 struct ftrace_ops *op;
edc15caf Steven Rostedt 2012-11-02 6224 int bit;
b848914c Steven Rostedt 2011-05-04 6225
edc15caf Steven Rostedt 2012-11-02 6226 bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX);
edc15caf Steven Rostedt 2012-11-02 6227 if (bit < 0)
b1cff0ad Steven Rostedt 2011-05-25 6228 return;
b1cff0ad Steven Rostedt 2011-05-25 6229
cdbe61bf Steven Rostedt 2011-05-05 6230 /*
cdbe61bf Steven Rostedt 2011-05-05 6231 * Some of the ops may be dynamically allocated,
74401729 Paul E. McKenney 2018-11-06 6232 * they must be freed after a synchronize_rcu().
cdbe61bf Steven Rostedt 2011-05-05 6233 */
cdbe61bf Steven Rostedt 2011-05-05 6234 preempt_disable_notrace();
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6235)
0a016409 Steven Rostedt 2012-11-02 6236 do_for_each_ftrace_op(op, ftrace_ops_list) {
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6237) /*
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6238) * Check the following for each ops before calling their func:
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6239) * if RCU flag is set, then rcu_is_watching() must be true
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6240) * if PER_CPU is set, then ftrace_function_local_disable()
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6241) * must be false
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6242) * Otherwise test if the ip matches the ops filter
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6243) *
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6244) * If any of the above fails then the op->func() is not executed.
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6245) */
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6246) if ((!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching()) &&
ba27f2bc Steven Rostedt (Red Hat 2015-11-30 6247) ftrace_ops_test(op, ip, regs)) {
1d48d596 Steven Rostedt (Red Hat 2014-06-25 6248) if (FTRACE_WARN_ON(!op->func)) {
1d48d596 Steven Rostedt (Red Hat 2014-06-25 6249) pr_warn("op=%p %pS\n", op, op);
4104d326 Steven Rostedt (Red Hat 2014-01-10 6250) goto out;
4104d326 Steven Rostedt (Red Hat 2014-01-10 6251) }
a1e2e31d Steven Rostedt 2011-08-09 6252 op->func(ip, parent_ip, op, regs);
4104d326 Steven Rostedt (Red Hat 2014-01-10 6253) }
0a016409 Steven Rostedt 2012-11-02 6254 } while_for_each_ftrace_op(op);
4104d326 Steven Rostedt (Red Hat 2014-01-10 6255) out:
cdbe61bf Steven Rostedt 2011-05-05 6256 preempt_enable_notrace();
edc15caf Steven Rostedt 2012-11-02 6257 trace_clear_recursion(bit);
b848914c Steven Rostedt 2011-05-04 6258 }
b848914c Steven Rostedt 2011-05-04 6259
2f5f6ad9 Steven Rostedt 2011-08-08 6260 /*
2f5f6ad9 Steven Rostedt 2011-08-08 6261 * Some archs only support passing ip and parent_ip. Even though
2f5f6ad9 Steven Rostedt 2011-08-08 6262 * the list function ignores the op parameter, we do not want any
2f5f6ad9 Steven Rostedt 2011-08-08 6263 * C side effects, where a function is called without the caller
2f5f6ad9 Steven Rostedt 2011-08-08 6264 * sending a third parameter.
a1e2e31d Steven Rostedt 2011-08-09 6265 * Archs are to support both the regs and ftrace_ops at the same time.
a1e2e31d Steven Rostedt 2011-08-09 6266 * If they support ftrace_ops, it is assumed they support regs.
a1e2e31d Steven Rostedt 2011-08-09 6267 * If call backs want to use regs, they must either check for regs
06aeaaea Masami Hiramatsu 2012-09-28 6268 * being NULL, or CONFIG_DYNAMIC_FTRACE_WITH_REGS.
06aeaaea Masami Hiramatsu 2012-09-28 6269 * Note, CONFIG_DYNAMIC_FTRACE_WITH_REGS expects a full regs to be saved.
a1e2e31d Steven Rostedt 2011-08-09 6270 * An architecture can pass partial regs with ftrace_ops and still
b8ec330a Li Bin 2015-11-30 6271 * set the ARCH_SUPPORTS_FTRACE_OPS.
2f5f6ad9 Steven Rostedt 2011-08-08 6272 */
2f5f6ad9 Steven Rostedt 2011-08-08 6273 #if ARCH_SUPPORTS_FTRACE_OPS
2f5f6ad9 Steven Rostedt 2011-08-08 6274 static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
a1e2e31d Steven Rostedt 2011-08-09 6275 struct ftrace_ops *op, struct pt_regs *regs)
2f5f6ad9 Steven Rostedt 2011-08-08 6276 {
a1e2e31d Steven Rostedt 2011-08-09 @6277 __ftrace_ops_list_func(ip, parent_ip, NULL, regs);
2f5f6ad9 Steven Rostedt 2011-08-08 6278 }
0b5a8971 Masami Hiramatsu 2019-01-07 6279 NOKPROBE_SYMBOL(ftrace_ops_list_func);
2f5f6ad9 Steven Rostedt 2011-08-08 6280 #else
2f5f6ad9 Steven Rostedt 2011-08-08 6281 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip)
2f5f6ad9 Steven Rostedt 2011-08-08 6282 {
a1e2e31d Steven Rostedt 2011-08-09 6283 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL);
2f5f6ad9 Steven Rostedt 2011-08-08 6284 }
0b5a8971 Masami Hiramatsu 2019-01-07 6285 NOKPROBE_SYMBOL(ftrace_ops_no_ops);
2f5f6ad9 Steven Rostedt 2011-08-08 6286 #endif
2f5f6ad9 Steven Rostedt 2011-08-08 6287

:::::: The code at line 6277 was first introduced by commit
:::::: a1e2e31d175a1349274eba3465d17616c6725f8c ftrace: Return pt_regs to function trace callback

:::::: TO: Steven Rostedt <srostedt@xxxxxxxxxx>
:::::: CC: Steven Rostedt <rostedt@xxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip