diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:31:01 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:01 -0500 |
commit | 86976cd805eccf46d9b720bb188a540fc5769427 (patch) | |
tree | 0bb47116e73fbf5bbb825d092784b54cb87163a5 | |
parent | e9c86c789f067f75211cedb3f13aa58369b0d14a (diff) |
x86: x86 ptrace merge syscall trace
This moves the 64-bit syscall tracing functions into ptrace.c,
so that ptrace_64.c becomes entirely obsolete.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/ptrace.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 7161d60e152d..509804957f5f 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -634,6 +634,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
634 | return ret; | 634 | return ret; |
635 | } | 635 | } |
636 | 636 | ||
637 | #ifdef CONFIG_X86_32 | ||
638 | |||
637 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) | 639 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) |
638 | { | 640 | { |
639 | struct siginfo info; | 641 | struct siginfo info; |
@@ -731,3 +733,65 @@ out: | |||
731 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); | 733 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); |
732 | return 1; | 734 | return 1; |
733 | } | 735 | } |
736 | |||
737 | #else /* CONFIG_X86_64 */ | ||
738 | |||
739 | static void syscall_trace(struct pt_regs *regs) | ||
740 | { | ||
741 | |||
742 | #if 0 | ||
743 | printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", | ||
744 | current->comm, | ||
745 | regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), | ||
746 | current_thread_info()->flags, current->ptrace); | ||
747 | #endif | ||
748 | |||
749 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | ||
750 | ? 0x80 : 0)); | ||
751 | /* | ||
752 | * this isn't the same as continuing with a signal, but it will do | ||
753 | * for normal use. strace only continues with a signal if the | ||
754 | * stopping signal is not SIGTRAP. -brl | ||
755 | */ | ||
756 | if (current->exit_code) { | ||
757 | send_sig(current->exit_code, current, 1); | ||
758 | current->exit_code = 0; | ||
759 | } | ||
760 | } | ||
761 | |||
762 | asmlinkage void syscall_trace_enter(struct pt_regs *regs) | ||
763 | { | ||
764 | /* do the secure computing check first */ | ||
765 | secure_computing(regs->orig_ax); | ||
766 | |||
767 | if (test_thread_flag(TIF_SYSCALL_TRACE) | ||
768 | && (current->ptrace & PT_PTRACED)) | ||
769 | syscall_trace(regs); | ||
770 | |||
771 | if (unlikely(current->audit_context)) { | ||
772 | if (test_thread_flag(TIF_IA32)) { | ||
773 | audit_syscall_entry(AUDIT_ARCH_I386, | ||
774 | regs->orig_ax, | ||
775 | regs->bx, regs->cx, | ||
776 | regs->dx, regs->si); | ||
777 | } else { | ||
778 | audit_syscall_entry(AUDIT_ARCH_X86_64, | ||
779 | regs->orig_ax, | ||
780 | regs->di, regs->si, | ||
781 | regs->dx, regs->r10); | ||
782 | } | ||
783 | } | ||
784 | } | ||
785 | |||
786 | asmlinkage void syscall_trace_leave(struct pt_regs *regs) | ||
787 | { | ||
788 | if (unlikely(current->audit_context)) | ||
789 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); | ||
790 | |||
791 | if ((test_thread_flag(TIF_SYSCALL_TRACE) | ||
792 | || test_thread_flag(TIF_SINGLESTEP)) | ||
793 | && (current->ptrace & PT_PTRACED)) | ||
794 | syscall_trace(regs); | ||
795 | } | ||
796 | |||
797 | #endif /* CONFIG_X86_32 */ | ||