lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202410031716.sTBC2OLt-lkp@intel.com>
Date: Thu, 3 Oct 2024 17:51:03 +0800
From: kernel test robot <lkp@...el.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Alexei Starovoitov <ast@...nel.org>, Yonghong Song <yhs@...com>,
	"Paul E . McKenney" <paulmck@...nel.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Andrii Nakryiko <andrii.nakryiko@...il.com>, bpf@...r.kernel.org,
	Joel Fernandes <joel@...lfernandes.org>,
	linux-trace-kernel@...r.kernel.org,
	Michael Jeanson <mjeanson@...icios.com>
Subject: Re: [PATCH resend 1/8] tracing: Declare system call tracepoints with
 TRACE_EVENT_SYSCALL

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 v6.12-rc1 next-20241003]
[cannot apply to rostedt-trace/for-next rostedt-trace/for-next-urgent tip/core/entry]
[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/20241001-032827
base:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
patch link:    https://lore.kernel.org/r/20240930192357.1154417-2-mathieu.desnoyers%40efficios.com
patch subject: [PATCH resend 1/8] tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL
config: riscv-allnoconfig (https://download.01.org/0day-ci/archive/20241003/202410031716.sTBC2OLt-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241003/202410031716.sTBC2OLt-lkp@intel.com/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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410031716.sTBC2OLt-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/trace/syscall.h:5,
                    from include/linux/syscalls.h:93,
                    from include/linux/entry-common.h:7,
                    from kernel/entry/common.c:4:
   include/trace/events/syscalls.h:20:18: error: expected ')' before 'struct'
      20 |         TP_PROTO(struct pt_regs *regs, long id),
         |                  ^~~~~~
   include/linux/tracepoint.h:106:25: note: in definition of macro 'PARAMS'
     106 | #define PARAMS(args...) args
         |                         ^~~~
   include/linux/tracepoint.h:614:9: note: in expansion of macro 'DECLARE_TRACE_SYSCALL'
     614 |         DECLARE_TRACE_SYSCALL(name, PARAMS(proto), PARAMS(args))
         |         ^~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint.h:614:37: note: in expansion of macro 'PARAMS'
     614 |         DECLARE_TRACE_SYSCALL(name, PARAMS(proto), PARAMS(args))
         |                                     ^~~~~~
   include/trace/events/syscalls.h:18:1: note: in expansion of macro 'TRACE_EVENT_SYSCALL'
      18 | TRACE_EVENT_SYSCALL(sys_enter,
         | ^~~~~~~~~~~~~~~~~~~
   include/trace/events/syscalls.h:20:9: note: in expansion of macro 'TP_PROTO'
      20 |         TP_PROTO(struct pt_regs *regs, long id),
         |         ^~~~~~~~
   include/trace/events/syscalls.h:46:18: error: expected ')' before 'struct'
      46 |         TP_PROTO(struct pt_regs *regs, long ret),
         |                  ^~~~~~
   include/linux/tracepoint.h:106:25: note: in definition of macro 'PARAMS'
     106 | #define PARAMS(args...) args
         |                         ^~~~
   include/linux/tracepoint.h:614:9: note: in expansion of macro 'DECLARE_TRACE_SYSCALL'
     614 |         DECLARE_TRACE_SYSCALL(name, PARAMS(proto), PARAMS(args))
         |         ^~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint.h:614:37: note: in expansion of macro 'PARAMS'
     614 |         DECLARE_TRACE_SYSCALL(name, PARAMS(proto), PARAMS(args))
         |                                     ^~~~~~
   include/trace/events/syscalls.h:44:1: note: in expansion of macro 'TRACE_EVENT_SYSCALL'
      44 | TRACE_EVENT_SYSCALL(sys_exit,
         | ^~~~~~~~~~~~~~~~~~~
   include/trace/events/syscalls.h:46:9: note: in expansion of macro 'TP_PROTO'
      46 |         TP_PROTO(struct pt_regs *regs, long ret),
         |         ^~~~~~~~
   kernel/entry/common.c: In function 'syscall_trace_enter':
>> kernel/entry/common.c:61:17: error: implicit declaration of function 'trace_syscall_sys_enter' [-Wimplicit-function-declaration]
      61 |                 trace_syscall_sys_enter(regs, syscall);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/entry/common.c: In function 'syscall_exit_work':
>> kernel/entry/common.c:169:17: error: implicit declaration of function 'trace_syscall_sys_exit' [-Wimplicit-function-declaration]
     169 |                 trace_syscall_sys_exit(regs, syscall_get_return_value(current, regs));
         |                 ^~~~~~~~~~~~~~~~~~~~~~


vim +/trace_syscall_sys_enter +61 kernel/entry/common.c

    27	
    28	long syscall_trace_enter(struct pt_regs *regs, long syscall,
    29					unsigned long work)
    30	{
    31		long ret = 0;
    32	
    33		/*
    34		 * Handle Syscall User Dispatch.  This must comes first, since
    35		 * the ABI here can be something that doesn't make sense for
    36		 * other syscall_work features.
    37		 */
    38		if (work & SYSCALL_WORK_SYSCALL_USER_DISPATCH) {
    39			if (syscall_user_dispatch(regs))
    40				return -1L;
    41		}
    42	
    43		/* Handle ptrace */
    44		if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
    45			ret = ptrace_report_syscall_entry(regs);
    46			if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
    47				return -1L;
    48		}
    49	
    50		/* Do seccomp after ptrace, to catch any tracer changes. */
    51		if (work & SYSCALL_WORK_SECCOMP) {
    52			ret = __secure_computing(NULL);
    53			if (ret == -1L)
    54				return ret;
    55		}
    56	
    57		/* Either of the above might have changed the syscall number */
    58		syscall = syscall_get_nr(current, regs);
    59	
    60		if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT)) {
  > 61			trace_syscall_sys_enter(regs, syscall);
    62			/*
    63			 * Probes or BPF hooks in the tracepoint may have changed the
    64			 * system call number as well.
    65			 */
    66			syscall = syscall_get_nr(current, regs);
    67		}
    68	
    69		syscall_enter_audit(regs, syscall);
    70	
    71		return ret ? : syscall;
    72	}
    73	
    74	noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs)
    75	{
    76		enter_from_user_mode(regs);
    77		instrumentation_begin();
    78		local_irq_enable();
    79		instrumentation_end();
    80	}
    81	
    82	/* Workaround to allow gradual conversion of architecture code */
    83	void __weak arch_do_signal_or_restart(struct pt_regs *regs) { }
    84	
    85	/**
    86	 * exit_to_user_mode_loop - do any pending work before leaving to user space
    87	 * @regs:	Pointer to pt_regs on entry stack
    88	 * @ti_work:	TIF work flags as read by the caller
    89	 */
    90	__always_inline unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
    91							     unsigned long ti_work)
    92	{
    93		/*
    94		 * Before returning to user space ensure that all pending work
    95		 * items have been completed.
    96		 */
    97		while (ti_work & EXIT_TO_USER_MODE_WORK) {
    98	
    99			local_irq_enable_exit_to_user(ti_work);
   100	
   101			if (ti_work & _TIF_NEED_RESCHED)
   102				schedule();
   103	
   104			if (ti_work & _TIF_UPROBE)
   105				uprobe_notify_resume(regs);
   106	
   107			if (ti_work & _TIF_PATCH_PENDING)
   108				klp_update_patch_state(current);
   109	
   110			if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
   111				arch_do_signal_or_restart(regs);
   112	
   113			if (ti_work & _TIF_NOTIFY_RESUME)
   114				resume_user_mode_work(regs);
   115	
   116			/* Architecture specific TIF work */
   117			arch_exit_to_user_mode_work(regs, ti_work);
   118	
   119			/*
   120			 * Disable interrupts and reevaluate the work flags as they
   121			 * might have changed while interrupts and preemption was
   122			 * enabled above.
   123			 */
   124			local_irq_disable_exit_to_user();
   125	
   126			/* Check if any of the above work has queued a deferred wakeup */
   127			tick_nohz_user_enter_prepare();
   128	
   129			ti_work = read_thread_flags();
   130		}
   131	
   132		/* Return the latest work state for arch_exit_to_user_mode() */
   133		return ti_work;
   134	}
   135	
   136	/*
   137	 * If SYSCALL_EMU is set, then the only reason to report is when
   138	 * SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP).  This syscall
   139	 * instruction has been already reported in syscall_enter_from_user_mode().
   140	 */
   141	static inline bool report_single_step(unsigned long work)
   142	{
   143		if (work & SYSCALL_WORK_SYSCALL_EMU)
   144			return false;
   145	
   146		return work & SYSCALL_WORK_SYSCALL_EXIT_TRAP;
   147	}
   148	
   149	static void syscall_exit_work(struct pt_regs *regs, unsigned long work)
   150	{
   151		bool step;
   152	
   153		/*
   154		 * If the syscall was rolled back due to syscall user dispatching,
   155		 * then the tracers below are not invoked for the same reason as
   156		 * the entry side was not invoked in syscall_trace_enter(): The ABI
   157		 * of these syscalls is unknown.
   158		 */
   159		if (work & SYSCALL_WORK_SYSCALL_USER_DISPATCH) {
   160			if (unlikely(current->syscall_dispatch.on_dispatch)) {
   161				current->syscall_dispatch.on_dispatch = false;
   162				return;
   163			}
   164		}
   165	
   166		audit_syscall_exit(regs);
   167	
   168		if (work & SYSCALL_WORK_SYSCALL_TRACEPOINT)
 > 169			trace_syscall_sys_exit(regs, syscall_get_return_value(current, regs));
   170	
   171		step = report_single_step(work);
   172		if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
   173			ptrace_report_syscall_exit(regs, step);
   174	}
   175	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ