Re: [PATCH v1 1/8] tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL

From: kernel test robot
Date: Fri Oct 04 2024 - 06:35:32 EST


Hi Mathieu,

kernel test robot noticed the following build errors:

[auto build test ERROR on peterz-queue/sched/core]
[also build test ERROR on linus/master tip/core/entry v6.12-rc1 next-20241004]
[cannot apply to rostedt-trace/for-next rostedt-trace/for-next-urgent]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mathieu-Desnoyers/tracing-Declare-system-call-tracepoints-with-TRACE_EVENT_SYSCALL/20241003-232114
base: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
patch link: https://lore.kernel.org/r/20241003151638.1608537-2-mathieu.desnoyers%40efficios.com
patch subject: [PATCH v1 1/8] tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL
config: powerpc-randconfig-r071-20241004 (https://download.01.org/0day-ci/archive/20241004/202410041838.pOZuOGTX-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410041838.pOZuOGTX-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410041838.pOZuOGTX-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

arch/powerpc/kernel/ptrace/ptrace.c: In function 'do_syscall_trace_enter':
>> arch/powerpc/kernel/ptrace/ptrace.c:298:17: error: implicit declaration of function 'trace_sys_enter'; did you mean 'ftrace_nmi_enter'? [-Wimplicit-function-declaration]
298 | trace_sys_enter(regs, regs->gpr[0]);
| ^~~~~~~~~~~~~~~
| ftrace_nmi_enter
arch/powerpc/kernel/ptrace/ptrace.c: In function 'do_syscall_trace_leave':
>> arch/powerpc/kernel/ptrace/ptrace.c:329:17: error: implicit declaration of function 'trace_sys_exit'; did you mean 'ftrace_nmi_exit'? [-Wimplicit-function-declaration]
329 | trace_sys_exit(regs, regs->result);
| ^~~~~~~~~~~~~~
| ftrace_nmi_exit

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [y]:
- RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]


vim +298 arch/powerpc/kernel/ptrace/ptrace.c

2449acc5348b94 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 235
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 236 /**
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 237 * do_syscall_trace_enter() - Do syscall tracing on kernel entry.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 238 * @regs: the pt_regs of the task to trace (current)
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 239 *
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 240 * Performs various types of tracing on syscall entry. This includes seccomp,
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 241 * ptrace, syscall tracepoints and audit.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 242 *
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 243 * The pt_regs are potentially visible to userspace via ptrace, so their
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 244 * contents is ABI.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 245 *
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 246 * One or more of the tracers may modify the contents of pt_regs, in particular
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 247 * to modify arguments or even the syscall number itself.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 248 *
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 249 * It's also possible that a tracer can choose to reject the system call. In
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 250 * that case this function will return an illegal syscall number, and will put
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 251 * an appropriate return value in regs->r3.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 252 *
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 253 * Return: the (possibly changed) syscall number.
^1da177e4c3f41 arch/ppc/kernel/ptrace.c Linus Torvalds 2005-04-16 254 */
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 255 long do_syscall_trace_enter(struct pt_regs *regs)
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 256 {
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 257 u32 flags;
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 258
985faa78687de6 arch/powerpc/kernel/ptrace/ptrace.c Mark Rutland 2021-11-29 259 flags = read_thread_flags() & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE);
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 260
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 261 if (flags) {
153474ba1a4aed arch/powerpc/kernel/ptrace/ptrace.c Eric W. Biederman 2022-01-27 262 int rc = ptrace_report_syscall_entry(regs);
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 263
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 264 if (unlikely(flags & _TIF_SYSCALL_EMU)) {
5521eb4bca2db7 arch/powerpc/kernel/ptrace.c Breno Leitao 2018-09-20 265 /*
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 266 * A nonzero return code from
153474ba1a4aed arch/powerpc/kernel/ptrace/ptrace.c Eric W. Biederman 2022-01-27 267 * ptrace_report_syscall_entry() tells us to prevent
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 268 * the syscall execution, but we are not going to
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 269 * execute it anyway.
a225f156740555 arch/powerpc/kernel/ptrace.c Elvira Khabirova 2018-12-07 270 *
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 271 * Returning -1 will skip the syscall execution. We want
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 272 * to avoid clobbering any registers, so we don't goto
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 273 * the skip label below.
5521eb4bca2db7 arch/powerpc/kernel/ptrace.c Breno Leitao 2018-09-20 274 */
5521eb4bca2db7 arch/powerpc/kernel/ptrace.c Breno Leitao 2018-09-20 275 return -1;
5521eb4bca2db7 arch/powerpc/kernel/ptrace.c Breno Leitao 2018-09-20 276 }
5521eb4bca2db7 arch/powerpc/kernel/ptrace.c Breno Leitao 2018-09-20 277
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 278 if (rc) {
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 279 /*
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 280 * The tracer decided to abort the syscall. Note that
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 281 * the tracer may also just change regs->gpr[0] to an
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 282 * invalid syscall number, that is handled below on the
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 283 * exit path.
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 284 */
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 285 goto skip;
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 286 }
8dbdec0bcb416d arch/powerpc/kernel/ptrace.c Dmitry V. Levin 2018-12-16 287 }
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 288
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 289 /* Run seccomp after ptrace; allow it to set gpr[3]. */
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 290 if (do_seccomp(regs))
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 291 return -1;
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 292
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 293 /* Avoid trace and audit when syscall is invalid. */
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 294 if (regs->gpr[0] >= NR_syscalls)
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 295 goto skip;
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 296
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 297 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 @298 trace_sys_enter(regs, regs->gpr[0]);
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 299
cab175f9fa2973 arch/powerpc/kernel/ptrace.c Denis Kirjanov 2010-08-27 300 if (!is_32bit_task())
91397401bb5072 arch/powerpc/kernel/ptrace.c Eric Paris 2014-03-11 301 audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 302 regs->gpr[5], regs->gpr[6]);
cfcd1705b61ecc arch/powerpc/kernel/ptrace.c David Woodhouse 2007-01-14 303 else
91397401bb5072 arch/powerpc/kernel/ptrace.c Eric Paris 2014-03-11 304 audit_syscall_entry(regs->gpr[0],
cfcd1705b61ecc arch/powerpc/kernel/ptrace.c David Woodhouse 2007-01-14 305 regs->gpr[3] & 0xffffffff,
cfcd1705b61ecc arch/powerpc/kernel/ptrace.c David Woodhouse 2007-01-14 306 regs->gpr[4] & 0xffffffff,
cfcd1705b61ecc arch/powerpc/kernel/ptrace.c David Woodhouse 2007-01-14 307 regs->gpr[5] & 0xffffffff,
cfcd1705b61ecc arch/powerpc/kernel/ptrace.c David Woodhouse 2007-01-14 308 regs->gpr[6] & 0xffffffff);
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 309
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 310 /* Return the possibly modified but valid syscall number */
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 311 return regs->gpr[0];
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 312
1addc57e111b92 arch/powerpc/kernel/ptrace.c Kees Cook 2016-06-02 313 skip:
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 314 /*
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 315 * If we are aborting explicitly, or if the syscall number is
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 316 * now invalid, set the return value to -ENOSYS.
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 317 */
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 318 regs->gpr[3] = -ENOSYS;
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 319 return -1;
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 320 }
d38374142b2560 arch/powerpc/kernel/ptrace.c Michael Ellerman 2015-07-23 321
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 322 void do_syscall_trace_leave(struct pt_regs *regs)
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 323 {
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 324 int step;
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 325
d7e7528bcd456f arch/powerpc/kernel/ptrace.c Eric Paris 2012-01-03 326 audit_syscall_exit(regs);
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 327
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 328 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 @329 trace_sys_exit(regs, regs->result);
02424d8966d803 arch/powerpc/kernel/ptrace.c Ian Munsie 2011-02-02 330
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 331 step = test_thread_flag(TIF_SINGLESTEP);
4f72c4279eab1e arch/powerpc/kernel/ptrace.c Roland McGrath 2008-07-27 332 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
153474ba1a4aed arch/powerpc/kernel/ptrace/ptrace.c Eric W. Biederman 2022-01-27 333 ptrace_report_syscall_exit(regs, step);
ea9c102cb0a796 arch/ppc/kernel/ptrace.c David Woodhouse 2005-05-08 334 }
002af9391bfbe8 arch/powerpc/kernel/ptrace.c Michael Ellerman 2018-10-12 335

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki