[PATCH v2 06/11] s390/tracing: fix compat syscall handling

2016-09-16 Thread Marcin Nowakowski
Add missing arch code - arch_trace_is_compat_syscall and
arch_syscall_addr

Signed-off-by: Marcin Nowakowski 
Cc: Steven Rostedt 
Cc: Ingo Molnar 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: linux-s...@vger.kernel.org
---
 arch/s390/include/asm/ftrace.h  | 11 +++
 arch/s390/include/asm/syscall.h |  1 +
 arch/s390/kernel/Makefile   |  1 +
 arch/s390/kernel/ftrace.c   | 12 
 4 files changed, 25 insertions(+)

diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index 64053d9..af8ba9c 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -82,5 +82,16 @@ static inline void ftrace_generate_call_insn(struct 
ftrace_insn *insn,
 #endif
 }
 
+#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_COMPAT)
+#include 
+#include 
+
+#define ARCH_COMPAT_SYSCALL_NUMBERS_OVERLAP 1
+static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
+{
+   return in_compat_syscall();
+}
+#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */
+
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_S390_FTRACE_H */
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 6ba0bf9..a08db5b 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * The syscall table always contains 32 bit pointers since we know that the
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 3234817..23572b8 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_COMPAT)  += compat_wrapper.o 
$(compat-obj-y)
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
 obj-$(CONFIG_KPROBES)  += kprobes.o
 obj-$(CONFIG_FUNCTION_TRACER)  += mcount.o ftrace.o
+obj-$(CONFIG_FTRACE_SYSCALLS)  += ftrace.o
 obj-$(CONFIG_CRASH_DUMP)   += crash_dump.o
 obj-$(CONFIG_UPROBES)  += uprobes.o
 
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index 0f7bfeb..31f7858 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -242,3 +242,15 @@ int ftrace_disable_ftrace_graph_caller(void)
 }
 
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
+#if (defined CONFIG_FTRACE_SYSCALLS) && (defined CONFIG_COMPAT)
+
+unsigned long __init arch_syscall_addr(int nr, bool compat)
+{
+   if (compat)
+   return (unsigned long)sys_call_table_emu[nr];
+
+   return (unsigned long)sys_call_table[nr];
+}
+
+#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */
-- 
2.7.4



[PATCH v2 06/11] s390/tracing: fix compat syscall handling

2016-09-16 Thread Marcin Nowakowski
Add missing arch code - arch_trace_is_compat_syscall and
arch_syscall_addr

Signed-off-by: Marcin Nowakowski 
Cc: Steven Rostedt 
Cc: Ingo Molnar 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: linux-s...@vger.kernel.org
---
 arch/s390/include/asm/ftrace.h  | 11 +++
 arch/s390/include/asm/syscall.h |  1 +
 arch/s390/kernel/Makefile   |  1 +
 arch/s390/kernel/ftrace.c   | 12 
 4 files changed, 25 insertions(+)

diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index 64053d9..af8ba9c 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -82,5 +82,16 @@ static inline void ftrace_generate_call_insn(struct 
ftrace_insn *insn,
 #endif
 }
 
+#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_COMPAT)
+#include 
+#include 
+
+#define ARCH_COMPAT_SYSCALL_NUMBERS_OVERLAP 1
+static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
+{
+   return in_compat_syscall();
+}
+#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */
+
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_S390_FTRACE_H */
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 6ba0bf9..a08db5b 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * The syscall table always contains 32 bit pointers since we know that the
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 3234817..23572b8 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_COMPAT)  += compat_wrapper.o 
$(compat-obj-y)
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
 obj-$(CONFIG_KPROBES)  += kprobes.o
 obj-$(CONFIG_FUNCTION_TRACER)  += mcount.o ftrace.o
+obj-$(CONFIG_FTRACE_SYSCALLS)  += ftrace.o
 obj-$(CONFIG_CRASH_DUMP)   += crash_dump.o
 obj-$(CONFIG_UPROBES)  += uprobes.o
 
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index 0f7bfeb..31f7858 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -242,3 +242,15 @@ int ftrace_disable_ftrace_graph_caller(void)
 }
 
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
+#if (defined CONFIG_FTRACE_SYSCALLS) && (defined CONFIG_COMPAT)
+
+unsigned long __init arch_syscall_addr(int nr, bool compat)
+{
+   if (compat)
+   return (unsigned long)sys_call_table_emu[nr];
+
+   return (unsigned long)sys_call_table[nr];
+}
+
+#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */
-- 
2.7.4