Skip to content

Commit 6e61ee3

Browse files
Matt Flemingtorvalds
authored andcommitted
C6X: use set_current_blocked() and block_sigmask()
As described in e6fa16a ("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 5e6292c ("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: Mark Salter <[email protected]> Cc: Aurelien Jacquiot <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Signed-off-by: Matt Fleming <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 389325b commit 6e61ee3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

arch/c6x/kernel/signal.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs)
8585
goto badframe;
8686

8787
sigdelsetmask(&set, ~_BLOCKABLE);
88-
spin_lock_irq(&current->sighand->siglock);
89-
current->blocked = set;
90-
recalc_sigpending();
91-
spin_unlock_irq(&current->sighand->siglock);
88+
set_current_blocked(&set);
9289

9390
if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
9491
goto badframe;
@@ -279,15 +276,8 @@ static int handle_signal(int sig,
279276

280277
/* Set up the stack frame */
281278
ret = setup_rt_frame(sig, ka, info, oldset, regs);
282-
if (ret == 0) {
283-
spin_lock_irq(&current->sighand->siglock);
284-
sigorsets(&current->blocked, &current->blocked,
285-
&ka->sa.sa_mask);
286-
if (!(ka->sa.sa_flags & SA_NODEFER))
287-
sigaddset(&current->blocked, sig);
288-
recalc_sigpending();
289-
spin_unlock_irq(&current->sighand->siglock);
290-
}
279+
if (ret == 0)
280+
block_sigmask(ka, sig);
291281

292282
return ret;
293283
}

0 commit comments

Comments
 (0)