lkml.org 
[lkml]   [2011]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 17/41] mn10300: Use set_current_blocked()
    Date
    From: Matt Fleming <matt.fleming@intel.com>

    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.

    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Matt Fleming <matt.fleming@intel.com>
    ---
    arch/mn10300/kernel/signal.c | 32 +++++++++++++-------------------
    1 files changed, 13 insertions(+), 19 deletions(-)

    diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
    index 690f4e9..107fb4e 100644
    --- a/arch/mn10300/kernel/signal.c
    +++ b/arch/mn10300/kernel/signal.c
    @@ -38,12 +38,13 @@
    */
    asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
    {
    - mask &= _BLOCKABLE;
    - spin_lock_irq(&current->sighand->siglock);
    + sigset_t blocked;
    +
    current->saved_sigmask = current->blocked;
    - siginitset(&current->blocked, mask);
    - recalc_sigpending();
    - spin_unlock_irq(&current->sighand->siglock);
    +
    + mask &= _BLOCKABLE;
    + siginitset(&blocked, mask);
    + set_current_blocked(&blocked);

    current->state = TASK_INTERRUPTIBLE;
    schedule();
    @@ -172,10 +173,7 @@ asmlinkage long sys_sigreturn(void)
    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 (restore_sigcontext(current_frame(), &frame->sc, &d0))
    goto badframe;
    @@ -203,10 +201,7 @@ asmlinkage long sys_rt_sigreturn(void)
    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 (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0))
    goto badframe;
    @@ -477,13 +472,12 @@ static int handle_signal(int sig,
    ret = setup_frame(sig, ka, oldset, regs);

    if (ret == 0) {
    - spin_lock_irq(&current->sighand->siglock);
    - sigorsets(&current->blocked, &current->blocked,
    - &ka->sa.sa_mask);
    + sigset_t blocked;
    +
    + sigorsets(&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);
    + sigaddset(&blocked, sig);
    + set_current_blocked(&blocked);
    }

    return ret;
    --
    1.7.4.4


    \
     
     \ /
      Last update: 2011-08-11 16:05    [W:0.024 / U:32.536 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site