]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
arch/tile: correct double syscall restart for nested signals
authorChris Metcalf <cmetcalf@tilera.com>
Thu, 28 Oct 2010 19:03:30 +0000 (15:03 -0400)
committerChris Metcalf <cmetcalf@tilera.com>
Mon, 1 Nov 2010 19:31:04 +0000 (15:31 -0400)
This change is modelled on similar fixes for other architectures.
The pt_regs "faultnum" member is set to the trap (fault) number that
caused us to enter the kernel, and is INT_SWINT_1 for the syscall software
interrupt.  We already supported a pseudo value, INT_SWINT_1_SIGRETURN,
that we used for the rt_sigreturn syscall; it avoided the case where
one signal was handled, then we "tail-called" to another handler.

This change avoids the similar case where we start to call one handler,
then are preempted into another handler when we start trying to run
the first handler.  We clear ->faultnum after calling handle_signal(),
and to be paranoid also in the case where there was no signal to deliver.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/kernel/signal.c

index fb28e85ae3aea3698c7d2cd5da564bb0a5f7fb0d..704ce0bce833ed1101a781a1f27da905506452de 100644 (file)
@@ -330,7 +330,7 @@ void do_signal(struct pt_regs *regs)
                        current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
                }
 
-               return;
+               goto done;
        }
 
        /* Did we come from a system call? */
@@ -358,4 +358,8 @@ void do_signal(struct pt_regs *regs)
                current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
                sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
        }
+
+done:
+       /* Avoid double syscall restart if there are nested signals. */
+       regs->faultnum = INT_SWINT_1_SIGRETURN;
 }