diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2012-12-22 00:21:10 -0500 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-03-21 15:39:34 -0400 |
commit | ef18272453c97238fc9a89211d4c609ef9c760dc (patch) | |
tree | f136861b2a31cc85027260775c9d00551c91d305 | |
parent | a937536b868b8369b98967929045f1df54234323 (diff) |
arch/tile: Call tracehook_report_syscall_{entry,exit} in syscall trace
Call tracehook functions for syscall tracing.
The check for TIF_SYSCALL_TRACE was removed, because the same check is
done right before in the assembly file.
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [with ptrace.h fixup]
-rw-r--r-- | arch/tile/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/tile/kernel/intvec_32.S | 10 | ||||
-rw-r--r-- | arch/tile/kernel/intvec_64.S | 10 | ||||
-rw-r--r-- | arch/tile/kernel/ptrace.c | 30 |
4 files changed, 28 insertions, 25 deletions
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h index 2e83fc1b9467..fd412260aff7 100644 --- a/arch/tile/include/asm/ptrace.h +++ b/arch/tile/include/asm/ptrace.h | |||
@@ -44,7 +44,8 @@ typedef unsigned long pt_reg_t; | |||
44 | struct pt_regs *get_pt_regs(struct pt_regs *); | 44 | struct pt_regs *get_pt_regs(struct pt_regs *); |
45 | 45 | ||
46 | /* Trace the current syscall. */ | 46 | /* Trace the current syscall. */ |
47 | extern void do_syscall_trace(void); | 47 | extern int do_syscall_trace_enter(struct pt_regs *regs); |
48 | extern void do_syscall_trace_exit(struct pt_regs *regs); | ||
48 | 49 | ||
49 | #define arch_has_single_step() (1) | 50 | #define arch_has_single_step() (1) |
50 | 51 | ||
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index f212bf7cea86..cb52d66343ed 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
@@ -1201,7 +1201,10 @@ handle_syscall: | |||
1201 | lw r30, r31 | 1201 | lw r30, r31 |
1202 | andi r30, r30, _TIF_SYSCALL_TRACE | 1202 | andi r30, r30, _TIF_SYSCALL_TRACE |
1203 | bzt r30, .Lrestore_syscall_regs | 1203 | bzt r30, .Lrestore_syscall_regs |
1204 | jal do_syscall_trace | 1204 | { |
1205 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1206 | jal do_syscall_trace_enter | ||
1207 | } | ||
1205 | FEEDBACK_REENTER(handle_syscall) | 1208 | FEEDBACK_REENTER(handle_syscall) |
1206 | 1209 | ||
1207 | /* | 1210 | /* |
@@ -1252,7 +1255,10 @@ handle_syscall: | |||
1252 | lw r30, r31 | 1255 | lw r30, r31 |
1253 | andi r30, r30, _TIF_SYSCALL_TRACE | 1256 | andi r30, r30, _TIF_SYSCALL_TRACE |
1254 | bzt r30, 1f | 1257 | bzt r30, 1f |
1255 | jal do_syscall_trace | 1258 | { |
1259 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1260 | jal do_syscall_trace_exit | ||
1261 | } | ||
1256 | FEEDBACK_REENTER(handle_syscall) | 1262 | FEEDBACK_REENTER(handle_syscall) |
1257 | 1: { | 1263 | 1: { |
1258 | movei r30, 0 /* not an NMI */ | 1264 | movei r30, 0 /* not an NMI */ |
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S index 4ea080902654..21991f72eba3 100644 --- a/arch/tile/kernel/intvec_64.S +++ b/arch/tile/kernel/intvec_64.S | |||
@@ -1006,7 +1006,10 @@ handle_syscall: | |||
1006 | addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET | 1006 | addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET |
1007 | beqzt r30, .Lrestore_syscall_regs | 1007 | beqzt r30, .Lrestore_syscall_regs |
1008 | } | 1008 | } |
1009 | jal do_syscall_trace | 1009 | { |
1010 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1011 | jal do_syscall_trace_enter | ||
1012 | } | ||
1010 | FEEDBACK_REENTER(handle_syscall) | 1013 | FEEDBACK_REENTER(handle_syscall) |
1011 | 1014 | ||
1012 | /* | 1015 | /* |
@@ -1077,7 +1080,10 @@ handle_syscall: | |||
1077 | andi r0, r30, _TIF_SINGLESTEP | 1080 | andi r0, r30, _TIF_SINGLESTEP |
1078 | beqzt r0, 1f | 1081 | beqzt r0, 1f |
1079 | } | 1082 | } |
1080 | jal do_syscall_trace | 1083 | { |
1084 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1085 | jal do_syscall_trace_exit | ||
1086 | } | ||
1081 | FEEDBACK_REENTER(handle_syscall) | 1087 | FEEDBACK_REENTER(handle_syscall) |
1082 | andi r0, r30, _TIF_SINGLESTEP | 1088 | andi r0, r30, _TIF_SINGLESTEP |
1083 | 1089 | ||
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c index 9835312d5a91..0ab8b76baddc 100644 --- a/arch/tile/kernel/ptrace.c +++ b/arch/tile/kernel/ptrace.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
22 | #include <linux/regset.h> | 22 | #include <linux/regset.h> |
23 | #include <linux/elf.h> | 23 | #include <linux/elf.h> |
24 | #include <linux/tracehook.h> | ||
24 | #include <asm/traps.h> | 25 | #include <asm/traps.h> |
25 | #include <arch/chip.h> | 26 | #include <arch/chip.h> |
26 | 27 | ||
@@ -246,29 +247,18 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
246 | } | 247 | } |
247 | #endif | 248 | #endif |
248 | 249 | ||
249 | void do_syscall_trace(void) | 250 | int do_syscall_trace_enter(struct pt_regs *regs) |
250 | { | 251 | { |
251 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 252 | if (tracehook_report_syscall_entry(regs)) { |
252 | return; | 253 | regs->regs[TREG_SYSCALL_NR] = -1; |
253 | 254 | } | |
254 | if (!(current->ptrace & PT_PTRACED)) | ||
255 | return; | ||
256 | 255 | ||
257 | /* | 256 | return regs->regs[TREG_SYSCALL_NR]; |
258 | * The 0x80 provides a way for the tracing parent to distinguish | 257 | } |
259 | * between a syscall stop and SIGTRAP delivery | ||
260 | */ | ||
261 | ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); | ||
262 | 258 | ||
263 | /* | 259 | void do_syscall_trace_exit(struct pt_regs *regs) |
264 | * this isn't the same as continuing with a signal, but it will do | 260 | { |
265 | * for normal use. strace only continues with a signal if the | 261 | tracehook_report_syscall_exit(regs, 0); |
266 | * stopping signal is not SIGTRAP. -brl | ||
267 | */ | ||
268 | if (current->exit_code) { | ||
269 | send_sig(current->exit_code, current, 1); | ||
270 | current->exit_code = 0; | ||
271 | } | ||
272 | } | 262 | } |
273 | 263 | ||
274 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) | 264 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) |