aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-05-10 20:58:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-05-21 23:52:32 -0400
commit97c47bb70728c765d6cbf582759f9170fe152ded (patch)
tree1a1280d64288ea4adcd01bd3d9eca46213c1f2ea /arch/h8300
parent9ae36796020998fcd07431934be6b160e9c7bfce (diff)
h8300: use set_current_blocked() and block_sigmask()
As described in e6fa16ab ("signal: sigprocmask() should do retarget_shared_pending()") the modification of current->blocked is incorrect as we need to check whether the signal we're about to block is pending in the shared queue. Also, use the new helper function introduced in commit 5e6292c0f28f ("signal: add block_sigmask() for adding sigmask to current->blocked") which centralises the code for updating current->blocked after successfully delivering a signal and reduces the amount of duplicate code across architectures. In the past some architectures got this code wrong, so using this helper function should stop that from happening again. Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/h8300')
-rw-r--r--arch/h8300/kernel/signal.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index af842c369d24..cd63f5a6c8fe 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -57,14 +57,13 @@ asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
57asmlinkage int do_sigsuspend(struct pt_regs *regs) 57asmlinkage int do_sigsuspend(struct pt_regs *regs)
58{ 58{
59 old_sigset_t mask = regs->er3; 59 old_sigset_t mask = regs->er3;
60 sigset_t saveset; 60 sigset_t saveset, blocked;
61 61
62 mask &= _BLOCKABLE;
63 spin_lock_irq(&current->sighand->siglock);
64 saveset = current->blocked; 62 saveset = current->blocked;
65 siginitset(&current->blocked, mask); 63
66 recalc_sigpending(); 64 mask &= _BLOCKABLE;
67 spin_unlock_irq(&current->sighand->siglock); 65 siginitset(&blocked, mask);
66 set_current_blocked(&blocked);
68 67
69 regs->er0 = -EINTR; 68 regs->er0 = -EINTR;
70 while (1) { 69 while (1) {
@@ -90,11 +89,8 @@ do_rt_sigsuspend(struct pt_regs *regs)
90 return -EFAULT; 89 return -EFAULT;
91 sigdelsetmask(&newset, ~_BLOCKABLE); 90 sigdelsetmask(&newset, ~_BLOCKABLE);
92 91
93 spin_lock_irq(&current->sighand->siglock);
94 saveset = current->blocked; 92 saveset = current->blocked;
95 current->blocked = newset; 93 set_current_blocked(&newset);
96 recalc_sigpending();
97 spin_unlock_irq(&current->sighand->siglock);
98 94
99 regs->er0 = -EINTR; 95 regs->er0 = -EINTR;
100 while (1) { 96 while (1) {
@@ -232,10 +228,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...)
232 goto badframe; 228 goto badframe;
233 229
234 sigdelsetmask(&set, ~_BLOCKABLE); 230 sigdelsetmask(&set, ~_BLOCKABLE);
235 spin_lock_irq(&current->sighand->siglock); 231 set_current_blocked(&set);
236 current->blocked = set;
237 recalc_sigpending();
238 spin_unlock_irq(&current->sighand->siglock);
239 232
240 if (restore_sigcontext(regs, &frame->sc, &er0)) 233 if (restore_sigcontext(regs, &frame->sc, &er0))
241 goto badframe; 234 goto badframe;
@@ -260,10 +253,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
260 goto badframe; 253 goto badframe;
261 254
262 sigdelsetmask(&set, ~_BLOCKABLE); 255 sigdelsetmask(&set, ~_BLOCKABLE);
263 spin_unlock_irq(&current->sighand->siglock); 256 set_current_blocked(&set);
264 current->blocked = set;
265 recalc_sigpending();
266 spin_lock_irq(&current->sighand->siglock);
267 257
268 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) 258 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0))
269 goto badframe; 259 goto badframe;
@@ -489,12 +479,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
489 else 479 else
490 setup_frame(sig, ka, oldset, regs); 480 setup_frame(sig, ka, oldset, regs);
491 481
492 spin_lock_irq(&current->sighand->siglock); 482 block_sigmask(ka, sig);
493 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
494 if (!(ka->sa.sa_flags & SA_NODEFER))
495 sigaddset(&current->blocked,sig);
496 recalc_sigpending();
497 spin_unlock_irq(&current->sighand->siglock);
498} 483}
499 484
500/* 485/*