[PATCH] do_sigaction: cleanup ->sa_mask manipulation

Clear unblockable signals beforehand.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Oleg Nesterov 2006-02-09 22:41:50 +03:00 committed by Linus Torvalds
parent c70d3d703a
commit 9ac95f2f90
2 changed files with 4 additions and 6 deletions

View File

@ -1098,7 +1098,7 @@ extern struct sigqueue *sigqueue_alloc(void);
extern void sigqueue_free(struct sigqueue *); extern void sigqueue_free(struct sigqueue *);
extern int send_sigqueue(int, struct sigqueue *, struct task_struct *); extern int send_sigqueue(int, struct sigqueue *, struct task_struct *);
extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *); extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *); extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
/* These can be the second arg to send_sig_info/send_group_sig_info. */ /* These can be the second arg to send_sig_info/send_group_sig_info. */

View File

@ -2430,7 +2430,7 @@ sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo)
} }
int int
do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
{ {
struct k_sigaction *k; struct k_sigaction *k;
sigset_t mask; sigset_t mask;
@ -2454,6 +2454,8 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
*oact = *k; *oact = *k;
if (act) { if (act) {
sigdelsetmask(&act->sa.sa_mask,
sigmask(SIGKILL) | sigmask(SIGSTOP));
/* /*
* POSIX 3.3.1.3: * POSIX 3.3.1.3:
* "Setting a signal action to SIG_IGN for a signal that is * "Setting a signal action to SIG_IGN for a signal that is
@ -2479,8 +2481,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
spin_lock_irq(&t->sighand->siglock); spin_lock_irq(&t->sighand->siglock);
*k = *act; *k = *act;
sigdelsetmask(&k->sa.sa_mask,
sigmask(SIGKILL) | sigmask(SIGSTOP));
sigemptyset(&mask); sigemptyset(&mask);
sigaddset(&mask, sig); sigaddset(&mask, sig);
rm_from_queue_full(&mask, &t->signal->shared_pending); rm_from_queue_full(&mask, &t->signal->shared_pending);
@ -2495,8 +2495,6 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
} }
*k = *act; *k = *act;
sigdelsetmask(&k->sa.sa_mask,
sigmask(SIGKILL) | sigmask(SIGSTOP));
} }
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);