]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/signal_64.c
x86 signals: lift flags diddling code
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / signal_64.c
index 827179c5b32a054ee9733b215fda94fbec8f8c48..3a76702dc3f18b53599d55b42c94801bdfc5d312 100644 (file)
@@ -289,10 +289,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
           see include/asm-x86_64/uaccess.h for details. */
        set_fs(USER_DS);
 
-       regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
-       if (test_thread_flag(TIF_SINGLESTEP))
-               ptrace_notify(SIGTRAP);
-
        return 0;
 
 give_sigsegv:
@@ -380,6 +376,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        ret = setup_rt_frame(sig, ka, info, oldset, regs);
 
        if (ret == 0) {
+               /*
+                * Clear the direction flag as per the ABI for function entry.
+                */
+               regs->flags &= ~X86_EFLAGS_DF;
+
+               /*
+                * Clear TF when entering the signal handler, but
+                * notify any tracer that was single-stepping it.
+                * The tracer may want to single-step inside the
+                * 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);
                if (!(ka->sa.sa_flags & SA_NODEFER))