diff options
author | Wade Farnsworth <wade_farnsworth@mentor.com> | 2012-04-04 11:19:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-04-25 14:49:28 -0400 |
commit | 0693bf68148c4473158e435383e75af70b704f78 (patch) | |
tree | 8bb62e5b4ad99f9dd87d90949b0772cb81cdd96f | |
parent | bf2c9f9866928df60157bc4f1ab39f93a32c754e (diff) |
ARM: 7374/1: add TRACEHOOK support
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>
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/ptrace.h | 5 | ||||
-rw-r--r-- | arch/arm/kernel/ptrace.c | 21 | ||||
-rw-r--r-- | arch/arm/kernel/signal.c | 2 |
4 files changed, 14 insertions, 15 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8b0c8ab53cb4..f5e4233766e3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -11,6 +11,7 @@ config ARM | |||
11 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) | 11 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) |
12 | select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL | 12 | select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL |
13 | select HAVE_ARCH_KGDB | 13 | select HAVE_ARCH_KGDB |
14 | select HAVE_ARCH_TRACEHOOK | ||
14 | select HAVE_KPROBES if !XIP_KERNEL | 15 | select HAVE_KPROBES if !XIP_KERNEL |
15 | select HAVE_KRETPROBES if (HAVE_KPROBES) | 16 | select HAVE_KRETPROBES if (HAVE_KPROBES) |
16 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) | 17 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) |
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 451808ba1211..355ece523f41 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h | |||
@@ -249,6 +249,11 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) | |||
249 | return regs->ARM_sp; | 249 | return regs->ARM_sp; |
250 | } | 250 | } |
251 | 251 | ||
252 | static inline unsigned long user_stack_pointer(struct pt_regs *regs) | ||
253 | { | ||
254 | return regs->ARM_sp; | ||
255 | } | ||
256 | |||
252 | #endif /* __KERNEL__ */ | 257 | #endif /* __KERNEL__ */ |
253 | 258 | ||
254 | #endif /* __ASSEMBLY__ */ | 259 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 80abafb9bf33..50d5a7d1da36 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/hw_breakpoint.h> | 24 | #include <linux/hw_breakpoint.h> |
25 | #include <linux/regset.h> | 25 | #include <linux/regset.h> |
26 | #include <linux/audit.h> | 26 | #include <linux/audit.h> |
27 | #include <linux/tracehook.h> | ||
27 | 28 | ||
28 | #include <asm/pgtable.h> | 29 | #include <asm/pgtable.h> |
29 | #include <asm/traps.h> | 30 | #include <asm/traps.h> |
@@ -931,24 +932,14 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) | |||
931 | 932 | ||
932 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 933 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
933 | return scno; | 934 | return scno; |
934 | if (!(current->ptrace & PT_PTRACED)) | ||
935 | return scno; | ||
936 | 935 | ||
937 | current_thread_info()->syscall = scno; | 936 | current_thread_info()->syscall = scno; |
938 | 937 | ||
939 | /* the 0x80 provides a way for the tracing parent to distinguish | 938 | if (why) |
940 | between a syscall stop and SIGTRAP delivery */ | 939 | tracehook_report_syscall_exit(regs, 0); |
941 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 940 | else if (tracehook_report_syscall_entry(regs)) |
942 | ? 0x80 : 0)); | 941 | current_thread_info()->syscall = -1; |
943 | /* | 942 | |
944 | * this isn't the same as continuing with a signal, but it will do | ||
945 | * for normal use. strace only continues with a signal if the | ||
946 | * stopping signal is not SIGTRAP. -brl | ||
947 | */ | ||
948 | if (current->exit_code) { | ||
949 | send_sig(current->exit_code, current, 1); | ||
950 | current->exit_code = 0; | ||
951 | } | ||
952 | regs->ARM_ip = ip; | 943 | regs->ARM_ip = ip; |
953 | 944 | ||
954 | return current_thread_info()->syscall; | 945 | return current_thread_info()->syscall; |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 7cb532fc8aa4..6e67f1bf1a6a 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -636,6 +636,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
636 | */ | 636 | */ |
637 | block_sigmask(ka, sig); | 637 | block_sigmask(ka, sig); |
638 | 638 | ||
639 | tracehook_signal_handler(sig, info, ka, regs, 0); | ||
640 | |||
639 | return 0; | 641 | return 0; |
640 | } | 642 | } |
641 | 643 | ||