Skip to content

Commit

Permalink
signal: sys_sigprocmask() needs retarget_shared_pending()
Browse files Browse the repository at this point in the history
sys_sigprocmask() changes current->blocked by hand. Convert this code
to use set_current_blocked().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
  • Loading branch information
Oleg Nesterov committed May 9, 2011
1 parent b013c39 commit 2e4f7c7
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2900,7 +2900,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
old_sigset_t __user *, oset)
{
old_sigset_t old_set, new_set;
int error;
sigset_t new_blocked;

old_set = current->blocked.sig[0];

Expand All @@ -2909,27 +2909,23 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
return -EFAULT;
new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));

error = 0;
spin_lock_irq(&current->sighand->siglock);
new_blocked = current->blocked;

switch (how) {
default:
error = -EINVAL;
break;
case SIG_BLOCK:
sigaddsetmask(&current->blocked, new_set);
sigaddsetmask(&new_blocked, new_set);
break;
case SIG_UNBLOCK:
sigdelsetmask(&current->blocked, new_set);
sigdelsetmask(&new_blocked, new_set);
break;
case SIG_SETMASK:
current->blocked.sig[0] = new_set;
new_blocked.sig[0] = new_set;
break;
default:
return -EINVAL;
}

recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
if (error)
return error;
set_current_blocked(&new_blocked);
}

if (oset) {
Expand Down

0 comments on commit 2e4f7c7

Please sign in to comment.