ARM: 7374/1: add TRACEHOOK support
authorWade Farnsworth <wade_farnsworth@mentor.com>
Wed, 4 Apr 2012 15:19:47 +0000 (16:19 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 25 Apr 2012 18:49:28 +0000 (19:49 +0100)
Add calls to tracehook_report_syscall_{entry,exit} and tracehook_signal_handler

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Wade Farnsworth <wade_farnsworth@mentor.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/Kconfig
arch/arm/include/asm/ptrace.h
arch/arm/kernel/ptrace.c
arch/arm/kernel/signal.c

index 8b0c8ab53cb4c4a64a4e93289dc83c4b1fe0ec3f..f5e4233766e30a640800474947156e3f9cf33344 100644 (file)
@@ -11,6 +11,7 @@ config ARM
        select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
        select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
        select HAVE_ARCH_KGDB
+       select HAVE_ARCH_TRACEHOOK
        select HAVE_KPROBES if !XIP_KERNEL
        select HAVE_KRETPROBES if (HAVE_KPROBES)
        select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
index 451808ba1211f2a547af60b35545b220d69886a9..355ece523f41f98d623f2c9af8d4d290a02af737 100644 (file)
@@ -249,6 +249,11 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
        return regs->ARM_sp;
 }
 
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+       return regs->ARM_sp;
+}
+
 #endif /* __KERNEL__ */
 
 #endif /* __ASSEMBLY__ */
index 80abafb9bf3374d5f6d86b67ee0f1b1260b7e9fc..50d5a7d1da3656128435ad06b63a47d1e0f95bc1 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/hw_breakpoint.h>
 #include <linux/regset.h>
 #include <linux/audit.h>
+#include <linux/tracehook.h>
 
 #include <asm/pgtable.h>
 #include <asm/traps.h>
@@ -931,24 +932,14 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
 
        if (!test_thread_flag(TIF_SYSCALL_TRACE))
                return scno;
-       if (!(current->ptrace & PT_PTRACED))
-               return scno;
 
        current_thread_info()->syscall = scno;
 
-       /* the 0x80 provides a way for the tracing parent to distinguish
-          between a syscall stop and SIGTRAP delivery */
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                                ? 0x80 : 0));
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (current->exit_code) {
-               send_sig(current->exit_code, current, 1);
-               current->exit_code = 0;
-       }
+       if (why)
+               tracehook_report_syscall_exit(regs, 0);
+       else if (tracehook_report_syscall_entry(regs))
+               current_thread_info()->syscall = -1;
+
        regs->ARM_ip = ip;
 
        return current_thread_info()->syscall;
index 7cb532fc8aa4e3a9dc1e9d63d4cb887a08b1fad1..6e67f1bf1a6a935ba7a8fd3497debe97e1082da1 100644 (file)
@@ -636,6 +636,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
         */
        block_sigmask(ka, sig);
 
+       tracehook_signal_handler(sig, info, ka, regs, 0);
+
        return 0;
 }