aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-26 21:44:21 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-01 09:58:19 -0400
commit12f79be93d94698778ff2b3f921073fc5f6780d6 (patch)
tree9a29c1fc56da1533e737ce3d0335e2686704e4c9 /arch/alpha
parent3cffdc8c3a4445bb3a4b1b31b10867edeb9fa288 (diff)
alpha: don't open-code trace_report_syscall_{enter,exit}
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/kernel/entry.S13
-rw-r--r--arch/alpha/kernel/ptrace.c32
2 files changed, 19 insertions, 26 deletions
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 7e43e1156d10..2a359c9ee3cd 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -418,11 +418,10 @@ $work_notifysig:
418strace: 418strace:
419 /* set up signal stack, call syscall_trace */ 419 /* set up signal stack, call syscall_trace */
420 bsr $1, do_switch_stack 420 bsr $1, do_switch_stack
421 jsr $26, syscall_trace 421 jsr $26, syscall_trace_enter /* returns the syscall number */
422 bsr $1, undo_switch_stack 422 bsr $1, undo_switch_stack
423 423
424 /* get the system call number and the arguments back.. */ 424 /* get the arguments back.. */
425 ldq $0, 0($sp)
426 ldq $16, SP_OFF+24($sp) 425 ldq $16, SP_OFF+24($sp)
427 ldq $17, SP_OFF+32($sp) 426 ldq $17, SP_OFF+32($sp)
428 ldq $18, SP_OFF+40($sp) 427 ldq $18, SP_OFF+40($sp)
@@ -449,7 +448,7 @@ $strace_success:
449 stq $0, 0($sp) /* save return value */ 448 stq $0, 0($sp) /* save return value */
450 449
451 bsr $1, do_switch_stack 450 bsr $1, do_switch_stack
452 jsr $26, syscall_trace 451 jsr $26, syscall_trace_leave
453 bsr $1, undo_switch_stack 452 bsr $1, undo_switch_stack
454 br $31, ret_from_sys_call 453 br $31, ret_from_sys_call
455 454
@@ -467,7 +466,7 @@ $strace_error:
467 bsr $1, do_switch_stack 466 bsr $1, do_switch_stack
468 mov $19, $9 /* save old syscall number */ 467 mov $19, $9 /* save old syscall number */
469 mov $20, $10 /* save old a3 */ 468 mov $20, $10 /* save old a3 */
470 jsr $26, syscall_trace 469 jsr $26, syscall_trace_leave
471 mov $9, $19 470 mov $9, $19
472 mov $10, $20 471 mov $10, $20
473 bsr $1, undo_switch_stack 472 bsr $1, undo_switch_stack
@@ -698,7 +697,7 @@ sys_sigreturn:
698 lda $sp, -SWITCH_STACK_SIZE($sp) 697 lda $sp, -SWITCH_STACK_SIZE($sp)
699 jsr $26, do_sigreturn 698 jsr $26, do_sigreturn
700 bne $9, 1f 699 bne $9, 1f
701 jsr $26, syscall_trace 700 jsr $26, syscall_trace_leave
7021: br $1, undo_switch_stack 7011: br $1, undo_switch_stack
703 br ret_from_sys_call 702 br ret_from_sys_call
704.end sys_sigreturn 703.end sys_sigreturn
@@ -715,7 +714,7 @@ sys_rt_sigreturn:
715 lda $sp, -SWITCH_STACK_SIZE($sp) 714 lda $sp, -SWITCH_STACK_SIZE($sp)
716 jsr $26, do_rt_sigreturn 715 jsr $26, do_rt_sigreturn
717 bne $9, 1f 716 bne $9, 1f
718 jsr $26, syscall_trace 717 jsr $26, syscall_trace_leave
7191: br $1, undo_switch_stack 7181: br $1, undo_switch_stack
720 br ret_from_sys_call 719 br ret_from_sys_call
721.end sys_rt_sigreturn 720.end sys_rt_sigreturn
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 54616f496aed..2a4a80ff4a20 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -13,6 +13,7 @@
13#include <linux/user.h> 13#include <linux/user.h>
14#include <linux/security.h> 14#include <linux/security.h>
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/tracehook.h>
16 17
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -312,25 +313,18 @@ long arch_ptrace(struct task_struct *child, long request,
312 return ret; 313 return ret;
313} 314}
314 315
316asmlinkage unsigned long syscall_trace_enter(void)
317{
318 unsigned long ret = 0;
319 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
320 tracehook_report_syscall_entry(current_pt_regs()))
321 ret = -1UL;
322 return ret ?: current_pt_regs()->r0;
323}
324
315asmlinkage void 325asmlinkage void
316syscall_trace(void) 326syscall_trace_leave(void)
317{ 327{
318 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 328 if (test_thread_flag(TIF_SYSCALL_TRACE))
319 return; 329 tracehook_report_syscall_exit(current_pt_regs(), 0);
320 if (!(current->ptrace & PT_PTRACED))
321 return;
322 /* The 0x80 provides a way for the tracing parent to distinguish
323 between a syscall stop and SIGTRAP delivery */
324 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
325 ? 0x80 : 0));
326
327 /*
328 * This isn't the same as continuing with a signal, but it will do
329 * for normal use. strace only continues with a signal if the
330 * stopping signal is not SIGTRAP. -brl
331 */
332 if (current->exit_code) {
333 send_sig(current->exit_code, current, 1);
334 current->exit_code = 0;
335 }
336} 330}