Commit ad092338350e517608a41341095b6b1e312c4eb1
Committed by
Chris Metcalf
1 parent
cf8c1dafe1
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
tile: 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: Arnd Bergmann <arnd@arndb.de> Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Showing 2 changed files with 3 additions and 15 deletions Side-by-side Diff
arch/tile/kernel/compat_signal.c
... | ... | @@ -303,10 +303,7 @@ |
303 | 303 | goto badframe; |
304 | 304 | |
305 | 305 | sigdelsetmask(&set, ~_BLOCKABLE); |
306 | - spin_lock_irq(¤t->sighand->siglock); | |
307 | - current->blocked = set; | |
308 | - recalc_sigpending(); | |
309 | - spin_unlock_irq(¤t->sighand->siglock); | |
306 | + set_current_blocked(&set); | |
310 | 307 | |
311 | 308 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
312 | 309 | goto badframe; |
arch/tile/kernel/signal.c
... | ... | @@ -97,10 +97,7 @@ |
97 | 97 | goto badframe; |
98 | 98 | |
99 | 99 | sigdelsetmask(&set, ~_BLOCKABLE); |
100 | - spin_lock_irq(¤t->sighand->siglock); | |
101 | - current->blocked = set; | |
102 | - recalc_sigpending(); | |
103 | - spin_unlock_irq(¤t->sighand->siglock); | |
100 | + set_current_blocked(&set); | |
104 | 101 | |
105 | 102 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
106 | 103 | goto badframe; |
... | ... | @@ -286,13 +283,7 @@ |
286 | 283 | * the work_pending path in the return-to-user code, and |
287 | 284 | * either way we can re-enable interrupts unconditionally. |
288 | 285 | */ |
289 | - spin_lock_irq(¤t->sighand->siglock); | |
290 | - sigorsets(¤t->blocked, | |
291 | - ¤t->blocked, &ka->sa.sa_mask); | |
292 | - if (!(ka->sa.sa_flags & SA_NODEFER)) | |
293 | - sigaddset(¤t->blocked, sig); | |
294 | - recalc_sigpending(); | |
295 | - spin_unlock_irq(¤t->sighand->siglock); | |
286 | + block_sigmask(ka, sig); | |
296 | 287 | } |
297 | 288 | |
298 | 289 | return ret; |