Commit bebbdf18 authored by Mikael Pettersson's avatar Mikael Pettersson Committed by Linus Torvalds

[PATCH] ppc signal handling fixes

2.6.8-rc2-mm1 reintroduced the signal-race-fixes patch for i386, x86_64,
s390, and ia64, breaking all other archs.

The patch below updates ppc, following the pattern of i386.  Compiled &
runtime tested.  No observable breakage.
Signed-off-by: default avatarMikael Pettersson <mikpe@csd.uu.se>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 04a73247
...@@ -600,7 +600,7 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8, ...@@ -600,7 +600,7 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
int do_signal(sigset_t *oldset, struct pt_regs *regs) int do_signal(sigset_t *oldset, struct pt_regs *regs)
{ {
siginfo_t info; siginfo_t info;
struct k_sigaction *ka; struct k_sigaction ka;
unsigned long frame, newsp; unsigned long frame, newsp;
int signr, ret; int signr, ret;
...@@ -609,9 +609,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) ...@@ -609,9 +609,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
newsp = frame = 0; newsp = frame = 0;
signr = get_signal_to_deliver(&info, regs, NULL); signr = get_signal_to_deliver(&info, &ka, regs, NULL);
ka = (signr == 0)? NULL: &current->sighand->action[signr-1];
if (TRAP(regs) == 0x0C00 /* System Call! */ if (TRAP(regs) == 0x0C00 /* System Call! */
&& regs->ccr & 0x10000000 /* error signalled */ && regs->ccr & 0x10000000 /* error signalled */
...@@ -622,7 +620,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) ...@@ -622,7 +620,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
if (signr > 0 if (signr > 0
&& (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK && (ret == ERESTARTNOHAND || ret == ERESTART_RESTARTBLOCK
|| (ret == ERESTARTSYS || (ret == ERESTARTSYS
&& !(ka->sa.sa_flags & SA_RESTART)))) { && !(ka.sa.sa_flags & SA_RESTART)))) {
/* make the system call return an EINTR error */ /* make the system call return an EINTR error */
regs->result = -EINTR; regs->result = -EINTR;
regs->gpr[3] = EINTR; regs->gpr[3] = EINTR;
...@@ -641,7 +639,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) ...@@ -641,7 +639,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
if (signr == 0) if (signr == 0)
return 0; /* no signals delivered */ return 0; /* no signals delivered */
if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size if ((ka.sa.sa_flags & SA_ONSTACK) && current->sas_ss_size
&& !on_sig_stack(regs->gpr[1])) && !on_sig_stack(regs->gpr[1]))
newsp = current->sas_ss_sp + current->sas_ss_size; newsp = current->sas_ss_sp + current->sas_ss_size;
else else
...@@ -649,17 +647,14 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) ...@@ -649,17 +647,14 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
newsp &= ~0xfUL; newsp &= ~0xfUL;
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
if (ka->sa.sa_flags & SA_SIGINFO) if (ka.sa.sa_flags & SA_SIGINFO)
handle_rt_signal(signr, ka, &info, oldset, regs, newsp); handle_rt_signal(signr, &ka, &info, oldset, regs, newsp);
else else
handle_signal(signr, ka, &info, oldset, regs, newsp); handle_signal(signr, &ka, &info, oldset, regs, newsp);
if (ka->sa.sa_flags & SA_ONESHOT)
ka->sa.sa_handler = SIG_DFL;
if (!(ka->sa.sa_flags & SA_NODEFER)) { if (!(ka.sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); sigorsets(&current->blocked,&current->blocked,&ka.sa.sa_mask);
sigaddset(&current->blocked, signr); sigaddset(&current->blocked, signr);
recalc_sigpending(); recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment