diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-02-13 20:40:59 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-03-07 01:06:09 -0500 |
commit | a2007ce8447c9a71d9d694ddcdf64f9dbbf022ff (patch) | |
tree | 03da8a35fdefdbea1ccd33d17faa71a1f0388b62 /arch | |
parent | a2234b4baefe2a2742b5fa8839be1ab1aca39057 (diff) |
powerpc: 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.
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/signal.c | 13 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal_32.c | 11 |
2 files changed, 8 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index ac6e437b1021..7006b7f4267a 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -57,10 +57,7 @@ void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
57 | void restore_sigmask(sigset_t *set) | 57 | void restore_sigmask(sigset_t *set) |
58 | { | 58 | { |
59 | sigdelsetmask(set, ~_BLOCKABLE); | 59 | sigdelsetmask(set, ~_BLOCKABLE); |
60 | spin_lock_irq(¤t->sighand->siglock); | 60 | set_current_blocked(set); |
61 | current->blocked = *set; | ||
62 | recalc_sigpending(); | ||
63 | spin_unlock_irq(¤t->sighand->siglock); | ||
64 | } | 61 | } |
65 | 62 | ||
66 | static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, | 63 | static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, |
@@ -169,13 +166,7 @@ static int do_signal(struct pt_regs *regs) | |||
169 | 166 | ||
170 | regs->trap = 0; | 167 | regs->trap = 0; |
171 | if (ret) { | 168 | if (ret) { |
172 | spin_lock_irq(¤t->sighand->siglock); | 169 | block_sigmask(&ka, signr); |
173 | sigorsets(¤t->blocked, ¤t->blocked, | ||
174 | &ka.sa.sa_mask); | ||
175 | if (!(ka.sa.sa_flags & SA_NODEFER)) | ||
176 | sigaddset(¤t->blocked, signr); | ||
177 | recalc_sigpending(); | ||
178 | spin_unlock_irq(¤t->sighand->siglock); | ||
179 | 170 | ||
180 | /* | 171 | /* |
181 | * A signal was successfully delivered; the saved sigmask is in | 172 | * A signal was successfully delivered; the saved sigmask is in |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 836a5a19eb2c..e061ef5dd449 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -242,12 +242,13 @@ static inline int restore_general_regs(struct pt_regs *regs, | |||
242 | */ | 242 | */ |
243 | long sys_sigsuspend(old_sigset_t mask) | 243 | long sys_sigsuspend(old_sigset_t mask) |
244 | { | 244 | { |
245 | mask &= _BLOCKABLE; | 245 | sigset_t blocked; |
246 | spin_lock_irq(¤t->sighand->siglock); | 246 | |
247 | current->saved_sigmask = current->blocked; | 247 | current->saved_sigmask = current->blocked; |
248 | siginitset(¤t->blocked, mask); | 248 | |
249 | recalc_sigpending(); | 249 | mask &= _BLOCKABLE; |
250 | spin_unlock_irq(¤t->sighand->siglock); | 250 | siginitset(&blocked, mask); |
251 | set_current_blocked(&blocked); | ||
251 | 252 | ||
252 | current->state = TASK_INTERRUPTIBLE; | 253 | current->state = TASK_INTERRUPTIBLE; |
253 | schedule(); | 254 | schedule(); |