diff options
author | Oleg Nesterov <oleg@redhat.com> | 2015-06-04 22:22:16 +0200 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-06-04 22:22:16 +0200 |
commit | 9e7c8f8c62c1e1cda203b5bfaba4575b141e42e7 (patch) | |
tree | ffbe4be8b34649fd07898137aeb74404f4fa093f /security | |
parent | selinux: Print 'sclass' as string when unrecognized netlink message occurs (diff) | |
download | linux-9e7c8f8c62c1e1cda203b5bfaba4575b141e42e7.tar.xz linux-9e7c8f8c62c1e1cda203b5bfaba4575b141e42e7.zip |
signals: don't abuse __flush_signals() in selinux_bprm_committed_creds()
selinux_bprm_committed_creds()->__flush_signals() is not right, we
shouldn't clear TIF_SIGPENDING unconditionally. There can be other
reasons for signal_pending(): freezing(), JOBCTL_PENDING_MASK, and
potentially more.
Also change this code to check fatal_signal_pending() rather than
SIGNAL_GROUP_EXIT, it looks a bit better.
Now we can kill __flush_signals() before it finds another buggy user.
Note: this code looks racy, we can flush a signal which was sent after
the task SID has been updated.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/hooks.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 99c4a00cce4e..8abbd548ece9 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2416,10 +2416,12 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) for (i = 0; i < 3; i++) do_setitimer(i, &itimer, NULL); spin_lock_irq(¤t->sighand->siglock); - if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) { - __flush_signals(current); + if (!fatal_signal_pending(current)) { + flush_sigqueue(¤t->pending); + flush_sigqueue(¤t->signal->shared_pending); flush_signal_handlers(current, 1); sigemptyset(¤t->blocked); + recalc_sigpending(); } spin_unlock_irq(¤t->sighand->siglock); } |