diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-27 13:58:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 12:58:51 -0400 |
commit | 77097ae503b170120ab66dd1d547f8577193f91f (patch) | |
tree | bee5b2e8d91b9ec8ab74c58cbec1796c7bacc2e5 /kernel | |
parent | edd63a2763bdae0daa4f0a4d4c5d61d1154352a5 (diff) |
most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set
Only 3 out of 63 do not. Renamed the current variant to __set_current_blocked(),
added set_current_blocked() that will exclude unblockable signals, switched
open-coded instances to it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/signal.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index b9be7e0fe41a..df8d721a9e6f 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2524,7 +2524,16 @@ static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset) | |||
2524 | * It is wrong to change ->blocked directly, this helper should be used | 2524 | * It is wrong to change ->blocked directly, this helper should be used |
2525 | * to ensure the process can't miss a shared signal we are going to block. | 2525 | * to ensure the process can't miss a shared signal we are going to block. |
2526 | */ | 2526 | */ |
2527 | void set_current_blocked(const sigset_t *newset) | 2527 | void set_current_blocked(sigset_t *newset) |
2528 | { | ||
2529 | struct task_struct *tsk = current; | ||
2530 | sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP)); | ||
2531 | spin_lock_irq(&tsk->sighand->siglock); | ||
2532 | __set_task_blocked(tsk, newset); | ||
2533 | spin_unlock_irq(&tsk->sighand->siglock); | ||
2534 | } | ||
2535 | |||
2536 | void __set_current_blocked(const sigset_t *newset) | ||
2528 | { | 2537 | { |
2529 | struct task_struct *tsk = current; | 2538 | struct task_struct *tsk = current; |
2530 | 2539 | ||
@@ -2564,7 +2573,7 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset) | |||
2564 | return -EINVAL; | 2573 | return -EINVAL; |
2565 | } | 2574 | } |
2566 | 2575 | ||
2567 | set_current_blocked(&newset); | 2576 | __set_current_blocked(&newset); |
2568 | return 0; | 2577 | return 0; |
2569 | } | 2578 | } |
2570 | 2579 | ||
@@ -3138,7 +3147,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset, | |||
3138 | return -EINVAL; | 3147 | return -EINVAL; |
3139 | } | 3148 | } |
3140 | 3149 | ||
3141 | set_current_blocked(&new_blocked); | 3150 | __set_current_blocked(&new_blocked); |
3142 | } | 3151 | } |
3143 | 3152 | ||
3144 | if (oset) { | 3153 | if (oset) { |
@@ -3202,7 +3211,6 @@ SYSCALL_DEFINE1(ssetmask, int, newmask) | |||
3202 | int old = current->blocked.sig[0]; | 3211 | int old = current->blocked.sig[0]; |
3203 | sigset_t newset; | 3212 | sigset_t newset; |
3204 | 3213 | ||
3205 | siginitset(&newset, newmask & ~(sigmask(SIGKILL) | sigmask(SIGSTOP))); | ||
3206 | set_current_blocked(&newset); | 3214 | set_current_blocked(&newset); |
3207 | 3215 | ||
3208 | return old; | 3216 | return old; |
@@ -3243,8 +3251,6 @@ SYSCALL_DEFINE0(pause) | |||
3243 | 3251 | ||
3244 | int sigsuspend(sigset_t *set) | 3252 | int sigsuspend(sigset_t *set) |
3245 | { | 3253 | { |
3246 | sigdelsetmask(set, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
3247 | |||
3248 | current->saved_sigmask = current->blocked; | 3254 | current->saved_sigmask = current->blocked; |
3249 | set_current_blocked(set); | 3255 | set_current_blocked(set); |
3250 | 3256 | ||