aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/signal.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 3e581865c8e2..d185bdd95a4b 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -630,7 +630,8 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
630static void 630static void
631handle_signal(struct ksignal *ksig, struct pt_regs *regs) 631handle_signal(struct ksignal *ksig, struct pt_regs *regs)
632{ 632{
633 bool failed; 633 bool stepping, failed;
634
634 /* Are we from a system call? */ 635 /* Are we from a system call? */
635 if (syscall_get_nr(current, regs) >= 0) { 636 if (syscall_get_nr(current, regs) >= 0) {
636 /* If so, check system call restarting.. */ 637 /* If so, check system call restarting.. */
@@ -654,12 +655,13 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
654 } 655 }
655 656
656 /* 657 /*
657 * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF 658 * If TF is set due to a debugger (TIF_FORCED_TF), clear TF now
658 * flag so that register information in the sigcontext is correct. 659 * so that register information in the sigcontext is correct and
660 * then notify the tracer before entering the signal handler.
659 */ 661 */
660 if (unlikely(regs->flags & X86_EFLAGS_TF) && 662 stepping = test_thread_flag(TIF_SINGLESTEP);
661 likely(test_and_clear_thread_flag(TIF_FORCED_TF))) 663 if (stepping)
662 regs->flags &= ~X86_EFLAGS_TF; 664 user_disable_single_step(current);
663 665
664 failed = (setup_rt_frame(ksig, regs) < 0); 666 failed = (setup_rt_frame(ksig, regs) < 0);
665 if (!failed) { 667 if (!failed) {
@@ -670,10 +672,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
670 * it might disable possible debug exception from the 672 * it might disable possible debug exception from the
671 * signal handler. 673 * signal handler.
672 * 674 *
673 * Clear TF when entering the signal handler, but 675 * Clear TF for the case when it wasn't set by debugger to
674 * notify any tracer that was single-stepping it. 676 * avoid the recursive send_sigtrap() in SIGTRAP handler.
675 * The tracer may want to single-step inside the
676 * handler too.
677 */ 677 */
678 regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF); 678 regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF);
679 /* 679 /*
@@ -682,7 +682,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
682 if (used_math()) 682 if (used_math())
683 fpu_reset_state(current); 683 fpu_reset_state(current);
684 } 684 }
685 signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP)); 685 signal_setup_done(failed, ksig, stepping);
686} 686}
687 687
688#ifdef CONFIG_X86_32 688#ifdef CONFIG_X86_32