Re: [PATCH 06/40] blackfin: Use set_current_blocked() and block_sigmask()

From: Bob Liu
Date: Thu Feb 16 2012 - 04:29:03 EST


On Tue, Feb 14, 2012 at 7:40 PM, Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote:
> From: Matt Fleming <matt.fleming@xxxxxxxxx>
>
> 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@xxxxxxxxxx>
> Acked-by: Mike Frysinger <vapier@xxxxxxxxxx>
> Cc: uclinux-dist-devel@xxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Matt Fleming <matt.fleming@xxxxxxxxx>
> ---
> Âarch/blackfin/kernel/signal.c | Â 17 ++++-------------
> Â1 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
> index d536f35..05ece02 100644
> --- a/arch/blackfin/kernel/signal.c
> +++ b/arch/blackfin/kernel/signal.c
> @@ -99,10 +99,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
> Â Â Â Â Â Â Â Âgoto badframe;
>
> Â Â Â Âsigdelsetmask(&set, ~_BLOCKABLE);
> - Â Â Â spin_lock_irq(&current->sighand->siglock);
> - Â Â Â current->blocked = set;
> - Â Â Â recalc_sigpending();
> - Â Â Â spin_unlock_irq(&current->sighand->siglock);
> + Â Â Â set_current_blocked(&set);
>
> Â Â Â Âif (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
> Â Â Â Â Â Â Â Âgoto badframe;
> @@ -266,15 +263,9 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
> Â Â Â Â/* set up the stack frame */
> Â Â Â Âret = setup_rt_frame(sig, ka, info, oldset, regs);
>
> - Â Â Â if (ret == 0) {
> - Â Â Â Â Â Â Â spin_lock_irq(&current->sighand->siglock);
> - Â Â Â Â Â Â Â sigorsets(&current->blocked, &current->blocked,
> - Â Â Â Â Â Â Â Â Â Â Â Â &ka->sa.sa_mask);
> - Â Â Â Â Â Â Â if (!(ka->sa.sa_flags & SA_NODEFER))
> - Â Â Â Â Â Â Â Â Â Â Â sigaddset(&current->blocked, sig);
> - Â Â Â Â Â Â Â recalc_sigpending();
> - Â Â Â Â Â Â Â spin_unlock_irq(&current->sighand->siglock);
> - Â Â Â }
> + Â Â Â if (ret == 0)
> + Â Â Â Â Â Â Â block_sigmask(ka, sig);
> +
> Â Â Â Âreturn ret;
> Â}
>

Thanks. I'll apply it.

--
Regards,
--Bob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/