]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86: tracehook_signal_handler
authorRoland McGrath <roland@redhat.com>
Sat, 15 Mar 2008 00:46:38 +0000 (17:46 -0700)
committerRoland McGrath <roland@redhat.com>
Sat, 26 Jul 2008 21:37:59 +0000 (14:37 -0700)
This makes the x86 signal handling code use tracehook_signal_handler() in
place of calling into ptrace guts.  The call is moved after the sa_mask
processing, but there is no other change.  This cleanup doesn't matter to
existing debuggers, but is the sensible thing: have all facets of the
handler setup complete before the debugger inspects the task again.

Signed-off-by: Roland McGrath <roland@redhat.com>
arch/x86/kernel/signal_32.c
arch/x86/kernel/signal_64.c

index 6fb5bcdd893366c66ccae845f2b1a20c076fa2f3..22aae1683c14b1f61e149d7e5967d8cfc4d51ed0 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
+#include <linux/tracehook.h>
 #include <linux/elf.h>
 #include <linux/smp.h>
 #include <linux/mm.h>
@@ -558,8 +559,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
         * handler too.
         */
        regs->flags &= ~X86_EFLAGS_TF;
-       if (test_thread_flag(TIF_SINGLESTEP))
-               ptrace_notify(SIGTRAP);
 
        spin_lock_irq(&current->sighand->siglock);
        sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
@@ -568,6 +567,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
+       tracehook_signal_handler(sig, info, ka, regs,
+                                test_thread_flag(TIF_SINGLESTEP));
+
        return 0;
 }
 
index b45ef8ddd6510901ab3d089e1ca21f36a90167d7..3beb2db88c5affce6605e42197d7181dde4236a8 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/unistd.h>
 #include <linux/stddef.h>
 #include <linux/personality.h>
@@ -444,8 +445,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
                 * handler too.
                 */
                regs->flags &= ~X86_EFLAGS_TF;
-               if (test_thread_flag(TIF_SINGLESTEP))
-                       ptrace_notify(SIGTRAP);
 
                spin_lock_irq(&current->sighand->siglock);
                sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
@@ -453,6 +452,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
                        sigaddset(&current->blocked,sig);
                recalc_sigpending();
                spin_unlock_irq(&current->sighand->siglock);
+
+               tracehook_signal_handler(sig, info, ka, regs,
+                                        test_thread_flag(TIF_SINGLESTEP));
        }
 
        return ret;