diff options
author | Oleg Nesterov <oleg@redhat.com> | 2009-12-15 19:47:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:08 -0500 |
commit | d51965037325e51f6cd68583413243c3573e47b0 (patch) | |
tree | b12a96e5adc82f3b72a22f054c9a51dc05d4a302 /arch/x86 | |
parent | 7f38551fc3ff0e17a38d6f3f0f8831380a88f3cc (diff) |
ptrace: x86: change syscall_trace_leave() to rely on tracehook when stepping
Suggested by Roland.
Unlike powepc, x86 always calls tracehook_report_syscall_exit(step) with
step = 0, and sends the trap by hand.
This results in unnecessary SIGTRAP when PTRACE_SINGLESTEP follows the
syscall-exit stop.
Change syscall_trace_leave() to pass the correct "step" argument to
tracehook and remove the send_sigtrap() logic.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 77b60085a810..2779321046bd 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1767,29 +1767,22 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs) | |||
1767 | 1767 | ||
1768 | asmregparm void syscall_trace_leave(struct pt_regs *regs) | 1768 | asmregparm void syscall_trace_leave(struct pt_regs *regs) |
1769 | { | 1769 | { |
1770 | bool step; | ||
1771 | |||
1770 | if (unlikely(current->audit_context)) | 1772 | if (unlikely(current->audit_context)) |
1771 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); | 1773 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); |
1772 | 1774 | ||
1773 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | 1775 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) |
1774 | trace_sys_exit(regs, regs->ax); | 1776 | trace_sys_exit(regs, regs->ax); |
1775 | 1777 | ||
1776 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
1777 | tracehook_report_syscall_exit(regs, 0); | ||
1778 | |||
1779 | /* | 1778 | /* |
1780 | * If TIF_SYSCALL_EMU is set, we only get here because of | 1779 | * If TIF_SYSCALL_EMU is set, we only get here because of |
1781 | * TIF_SINGLESTEP (i.e. this is PTRACE_SYSEMU_SINGLESTEP). | 1780 | * TIF_SINGLESTEP (i.e. this is PTRACE_SYSEMU_SINGLESTEP). |
1782 | * We already reported this syscall instruction in | 1781 | * We already reported this syscall instruction in |
1783 | * syscall_trace_enter(), so don't do any more now. | 1782 | * syscall_trace_enter(). |
1784 | */ | ||
1785 | if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) | ||
1786 | return; | ||
1787 | |||
1788 | /* | ||
1789 | * If we are single-stepping, synthesize a trap to follow the | ||
1790 | * system call instruction. | ||
1791 | */ | 1783 | */ |
1792 | if (test_thread_flag(TIF_SINGLESTEP) && | 1784 | step = unlikely(test_thread_flag(TIF_SINGLESTEP)) && |
1793 | tracehook_consider_fatal_signal(current, SIGTRAP)) | 1785 | !test_thread_flag(TIF_SYSCALL_EMU); |
1794 | send_sigtrap(current, regs, 0, TRAP_BRKPT); | 1786 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) |
1787 | tracehook_report_syscall_exit(regs, step); | ||
1795 | } | 1788 | } |