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>
This commit is contained in:
@@ -2524,7 +2524,16 @@ static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset)
|
||||
* It is wrong to change ->blocked directly, this helper should be used
|
||||
* to ensure the process can't miss a shared signal we are going to block.
|
||||
*/
|
||||
void set_current_blocked(const sigset_t *newset)
|
||||
void set_current_blocked(sigset_t *newset)
|
||||
{
|
||||
struct task_struct *tsk = current;
|
||||
sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP));
|
||||
spin_lock_irq(&tsk->sighand->siglock);
|
||||
__set_task_blocked(tsk, newset);
|
||||
spin_unlock_irq(&tsk->sighand->siglock);
|
||||
}
|
||||
|
||||
void __set_current_blocked(const sigset_t *newset)
|
||||
{
|
||||
struct task_struct *tsk = current;
|
||||
|
||||
@@ -2564,7 +2573,7 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
set_current_blocked(&newset);
|
||||
__set_current_blocked(&newset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3138,7 +3147,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
set_current_blocked(&new_blocked);
|
||||
__set_current_blocked(&new_blocked);
|
||||
}
|
||||
|
||||
if (oset) {
|
||||
@@ -3202,7 +3211,6 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)
|
||||
int old = current->blocked.sig[0];
|
||||
sigset_t newset;
|
||||
|
||||
siginitset(&newset, newmask & ~(sigmask(SIGKILL) | sigmask(SIGSTOP)));
|
||||
set_current_blocked(&newset);
|
||||
|
||||
return old;
|
||||
@@ -3243,8 +3251,6 @@ SYSCALL_DEFINE0(pause)
|
||||
|
||||
int sigsuspend(sigset_t *set)
|
||||
{
|
||||
sigdelsetmask(set, sigmask(SIGKILL)|sigmask(SIGSTOP));
|
||||
|
||||
current->saved_sigmask = current->blocked;
|
||||
set_current_blocked(set);
|
||||
|
||||
|
Reference in New Issue
Block a user