Re: [PATCH v2 09/11] tile/tracing: fix compat syscall handling

2016-09-20 Thread Chris Metcalf

On 9/16/2016 3:11 AM, Marcin Nowakowski wrote:

Add missing arch code - arch_trace_is_compat_syscall and
arch_syscall_addr

Signed-off-by: Marcin Nowakowski
Cc:Cc:  Steven Rostedt
Cc: Ingo Molnar
Cc: Chris Metcalf
---
  arch/tile/include/asm/ftrace.h | 10 ++
  arch/tile/kernel/Makefile  |  1 +
  arch/tile/kernel/ftrace.c  | 13 +
  3 files changed, 24 insertions(+)


This looks OK with the exception of needing is_compat_task() instead
of in_compat_syscall().  With that change:

Signed-of-by: Chris Metcalf 

--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com



Re: [PATCH v2 09/11] tile/tracing: fix compat syscall handling

2016-09-16 Thread kbuild test robot
Hi Marcin,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.8-rc6 next-20160916]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Marcin-Nowakowski/syscall-tracing-compat-syscall-support/20160916-152237
config: tile-allyesconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   In file included from include/linux/ftrace.h:20:0,
   from include/linux/perf_event.h:47,
   from arch/tile/kernel/irq.c:24:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/process.c:19:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   In file included from arch/tile/kernel/process.c:24:0:
   include/linux/compat.h: At top level:
>> include/linux/compat.h:806:20: error: conflicting types for 
>> 'in_compat_syscall'
   arch/tile/include/asm/ftrace.h:44:9: note: previous implicit declaration of 
'in_compat_syscall' was here
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/ptrace.c:19:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   In file included from arch/tile/kernel/ptrace.c:20:0:
   include/linux/compat.h: At top level:
>> include/linux/compat.h:806:20: error: conflicting types for 
>> 'in_compat_syscall'
   arch/tile/include/asm/ftrace.h:44:9: note: previous implicit declaration of 
'in_compat_syscall' was here
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/stack.c:17:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/perf_event.h:47,
   from include/linux/trace_events.h:9,
   from include/trace/syscall.h:6,
   from include/linux/syscalls.h:81,
   from arch/tile/kernel/sys.c:23:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   In file included from arch/tile/kernel/sys.c:29:0:
   include/linux/compat.h: At top level:
>> include/linux/compat.h:806:20: error: conflicting types for 
>> 'in_compat_syscall'
   arch/tile/include/asm/ftrace.h:44:9: note: previous implicit declaration of 
'in_compat_syscall' was here
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/traps.c:17:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/hardwall.c:19:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: error: implicit declaration of function 
>> 'in_compat_syscall'
   In file included from arch/tile/kernel/hardwall.c:25:0:
   include/linux/compat.h: At top level:
>> include/linux/compat.h:806:20: error: conflicting types for 
>> 'in_compat_syscall'
   arch/tile/include/asm/ftrace.h:44:9: note: previous implicit declaration of 
'in_compat_syscall' was here
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ftrace.h:20:0,
   from include/linux/kprobes.h:42,
   from arch/tile/kernel/perf_event.c:29:
   arch/tile/include/asm/ftrace.h: In function 'arch_trace_is_compat_syscall':
>> arch/tile/include/asm/ftrace.h:44:2: err

[PATCH v2 09/11] tile/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:Cc:  Steven Rostedt 
Cc: Ingo Molnar 
Cc: Chris Metcalf 
---
 arch/tile/include/asm/ftrace.h | 10 ++
 arch/tile/kernel/Makefile  |  1 +
 arch/tile/kernel/ftrace.c  | 13 +
 3 files changed, 24 insertions(+)

diff --git a/arch/tile/include/asm/ftrace.h b/arch/tile/include/asm/ftrace.h
index 738d239..e99b598 100644
--- a/arch/tile/include/asm/ftrace.h
+++ b/arch/tile/include/asm/ftrace.h
@@ -35,6 +35,16 @@ struct dyn_arch_ftrace {
 };
 #endif /*  CONFIG_DYNAMIC_FTRACE */
 
+#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_COMPAT)
+#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 /* CONFIG_FUNCTION_TRACER */
diff --git a/arch/tile/kernel/Makefile b/arch/tile/kernel/Makefile
index 09936d0..4de0989 100644
--- a/arch/tile/kernel/Makefile
+++ b/arch/tile/kernel/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_USE_PMC) += pmc.o
 obj-$(CONFIG_TILE_USB) += usb.o
 obj-$(CONFIG_TILE_HVGLUE_TRACE)+= hvglue_trace.o
 obj-$(CONFIG_FUNCTION_TRACER)  += ftrace.o mcount_64.o
+obj-$(CONFIG_FTRACE_SYSCALLS)  += ftrace.o
 obj-$(CONFIG_KPROBES)  += kprobes.o
 obj-$(CONFIG_KGDB) += kgdb.o
 obj-$(CONFIG_JUMP_LABEL)   += jump_label.o
diff --git a/arch/tile/kernel/ftrace.c b/arch/tile/kernel/ftrace.c
index 4a57208..0e71b6b 100644
--- a/arch/tile/kernel/ftrace.c
+++ b/arch/tile/kernel/ftrace.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -237,3 +238,15 @@ int ftrace_disable_ftrace_graph_caller(void)
 }
 #endif /* CONFIG_DYNAMIC_FTRACE */
 #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)compat_sys_call_table[nr];
+
+   return (unsigned long)sys_call_table[nr];
+}
+
+#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_COMPAT */
-- 
2.7.4