All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tracing/x86: Update syscall trace events to handle new x86 syscall func names
@ 2018-04-17 17:07 Steven Rostedt
  2018-04-17 17:22 ` Dominik Brodowski
  2018-04-17 17:29 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 16+ messages in thread
From: Steven Rostedt @ 2018-04-17 17:07 UTC (permalink / raw)
  To: LKML
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	Arnaldo Carvalho de Melo, x86, Dominik Brodowski

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Arnaldo noticed that the latest kernel is missing the syscall event system
directory in x86. I bisected it down to d5a00528b58c ("syscalls/core,
syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()").

The system call trace events are special, as there is only one trace event
for all system calls (the raw_syscalls). But a macro that wraps the system
calls creates meta data for them that copies the name to find the system
call that maps to the system call table (the number). At boot up, it does a
kallsyms lookup for this mapping. If it does not find a function, then that
system call is ignored.

Because the x86 system calls had "__x64_" appended to the "sys" for the
names, they do not match the default compare algorithm. As this was a
problem for power pc, the algorithm can be overwritten by the architecture.
The solution is to have x86 have its own algorithm to do the compare and
this brings back the system call trace events.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Fixes: d5a00528b58c ("syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Changes since v1:

  Added back original compare to not miss 32bit kernel syscalls

 arch/x86/include/asm/ftrace.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 09ad88572746..975b8c73bd50 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -31,6 +31,16 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 	return addr;
 }
 
+#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
+static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
+{
+	/*
+	 * Compare the symbol name with the system call name. Skip the
+	 * "__x64_sys" or simple "sys" prefix.
+	 */
+	return !strcmp(sym + 9, name + 3) || !strcmp(sym + 3, name + 3);
+}
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 struct dyn_arch_ftrace {
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-04-18 15:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 17:07 [PATCH v2] tracing/x86: Update syscall trace events to handle new x86 syscall func names Steven Rostedt
2018-04-17 17:22 ` Dominik Brodowski
2018-04-17 18:04   ` Arnaldo Carvalho de Melo
2018-04-17 18:13     ` Arnaldo Carvalho de Melo
2018-04-17 18:16       ` Steven Rostedt
2018-04-17 21:41       ` Steven Rostedt
2018-04-18 12:53         ` Arnaldo Carvalho de Melo
2018-04-18 14:36           ` Steven Rostedt
2018-04-18 15:02             ` Arnaldo Carvalho de Melo
2018-04-18 15:17               ` Arnaldo Carvalho de Melo
2018-04-18 15:20                 ` Steven Rostedt
2018-04-18 15:25                   ` Arnaldo Carvalho de Melo
2018-04-18 15:30                     ` Steven Rostedt
2018-04-18 15:45   ` Steven Rostedt
2018-04-17 17:29 ` Arnaldo Carvalho de Melo
2018-04-17 17:56   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.