Skip to content

Commit 1c758a2

Browse files
committed
tracing/x86: Update syscall trace events to handle new prefixed syscall func names
Arnaldo noticed that the latest kernel is missing the syscall event system directory in x86. I bisected it down to d5a0052 ("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 of the system call table to find the function that maps to the meta data of the system call. If it does not find a function, then that system call is ignored. Because the x86 system calls had "__x64_", or "__ia32_" prefixed 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. Link: http://lkml.kernel.org/r/[email protected] Reported-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Acked-by: Dominik Brodowski <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Fixes: d5a0052 ("syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()") Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 1cdae04 commit 1c758a2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

arch/x86/include/asm/ftrace.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,21 @@ int ftrace_int3_handler(struct pt_regs *regs);
4646
#endif /* CONFIG_FUNCTION_TRACER */
4747

4848

49-
#if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS)
49+
#ifndef __ASSEMBLY__
50+
51+
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
52+
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
53+
{
54+
/*
55+
* Compare the symbol name with the system call name. Skip the
56+
* "__x64_sys", "__ia32_sys" or simple "sys" prefix.
57+
*/
58+
return !strcmp(sym + 3, name + 3) ||
59+
(!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) ||
60+
(!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3));
61+
}
62+
63+
#ifndef COMPILE_OFFSETS
5064

5165
#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
5266
#include <asm/compat.h>
@@ -67,6 +81,7 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
6781
return false;
6882
}
6983
#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
70-
#endif /* !__ASSEMBLY__ && !COMPILE_OFFSETS */
84+
#endif /* !COMPILE_OFFSETS */
85+
#endif /* !__ASSEMBLY__ */
7186

7287
#endif /* _ASM_X86_FTRACE_H */

0 commit comments

Comments
 (0)