diff options
author | Daniel Jacobowitz <drow@false.org> | 2005-11-19 05:01:07 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-19 05:01:07 -0500 |
commit | a6c61e9dfdd0adf8443932cfc43b0c1e25036ad5 (patch) | |
tree | 68e09d27ce1ef0aecbe11fb9eb139fba92e1afe9 /arch/arm/kernel/signal.c | |
parent | d2c5b69099ff747f9757da2416383b9a999171b1 (diff) |
[ARM] 3168/1: Update ARM signal delivery and masking
Patch from Daniel Jacobowitz
After delivering a signal (creating its stack frame) we must check for
additional pending unblocked signals before returning to userspace.
Otherwise signals may be delayed past the next syscall or reschedule.
Once that was fixed it became obvious that the ARM signal mask manipulation
was broken. It was a little bit broken before the recent SA_NODEFER
changes, and then very broken after them. We must block the requested
signals before starting the handler or the same signal can be delivered
again before the handler even gets a chance to run.
Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/signal.c')
-rw-r--r-- | arch/arm/kernel/signal.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index a917e3dd3666..765922bcf9e7 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -595,23 +595,22 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
595 | */ | 595 | */ |
596 | ret |= !valid_user_regs(regs); | 596 | ret |= !valid_user_regs(regs); |
597 | 597 | ||
598 | /* | ||
599 | * Block the signal if we were unsuccessful. | ||
600 | */ | ||
601 | if (ret != 0) { | 598 | if (ret != 0) { |
602 | spin_lock_irq(&tsk->sighand->siglock); | 599 | force_sigsegv(sig, tsk); |
603 | sigorsets(&tsk->blocked, &tsk->blocked, | 600 | return; |
604 | &ka->sa.sa_mask); | ||
605 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
606 | sigaddset(&tsk->blocked, sig); | ||
607 | recalc_sigpending(); | ||
608 | spin_unlock_irq(&tsk->sighand->siglock); | ||
609 | } | 601 | } |
610 | 602 | ||
611 | if (ret == 0) | 603 | /* |
612 | return; | 604 | * Block the signal if we were successful. |
605 | */ | ||
606 | spin_lock_irq(&tsk->sighand->siglock); | ||
607 | sigorsets(&tsk->blocked, &tsk->blocked, | ||
608 | &ka->sa.sa_mask); | ||
609 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
610 | sigaddset(&tsk->blocked, sig); | ||
611 | recalc_sigpending(); | ||
612 | spin_unlock_irq(&tsk->sighand->siglock); | ||
613 | 613 | ||
614 | force_sigsegv(sig, tsk); | ||
615 | } | 614 | } |
616 | 615 | ||
617 | /* | 616 | /* |