lkml.org 
[lkml]   [2011]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v2 5/6] signal: sys_sigprocmask() needs retarget_shared_pending()
sys_sigprocmask() changes current->blocked by hand. Convert this code to
use sigprocmask() which implies the necessary retarget_shared_pending().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
--- sigprocmask/kernel/signal.c~5_old_sigprocmask_retarget 2011-04-26 19:54:09.000000000 +0200
+++ sigprocmask/kernel/signal.c 2011-04-26 19:54:20.000000000 +0200
@@ -2702,6 +2702,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, o
old_sigset_t __user *, oset)
{
old_sigset_t old_set, new_set;
+ sigset_t new_full_set;
int error;

old_set = current->blocked.sig[0];
@@ -2711,25 +2712,12 @@ SYSCALL_DEFINE3(sigprocmask, int, how, o
return -EFAULT;
new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));

- error = 0;
- spin_lock_irq(&current->sighand->siglock);
- switch (how) {
- default:
- error = -EINVAL;
- break;
- case SIG_BLOCK:
- sigaddsetmask(&current->blocked, new_set);
- break;
- case SIG_UNBLOCK:
- sigdelsetmask(&current->blocked, new_set);
- break;
- case SIG_SETMASK:
- current->blocked.sig[0] = new_set;
- break;
- }
+ sigemptyset(&new_full_set);
+ if (how == SIG_SETMASK)
+ new_full_set = current->blocked;
+ new_full_set.sig[0] = new_set;

- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
+ error = sigprocmask(how, &new_full_set, NULL);
if (error)
return error;
}


\
 
 \ /
  Last update: 2011-04-26 21:53    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site