lkml.org 
[lkml]   [2014]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 09/11] signals: disallow_signal() should flush the potentially pending signal
disallow_signal() simply sets SIG_IGN, this is not enough and
recalc_sigpending() is simply pointless because in can never
change the state of TIF_SIGPENDING.

If we ignore a signal, we also need to do flush_sigqueue_mask() for
the case when this signal is pending, this way recalc_sigpending()
can actually clear TIF_SIGPENDING and we do not "leak" the allocated
siginfo's.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 30bfe53..a615110 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3082,8 +3082,15 @@ EXPORT_SYMBOL(allow_signal);

void disallow_signal(int sig)
{
+ sigset_t mask;
+
+ sigemptyset(&mask);
+ sigaddset(&mask, sig);
+
spin_lock_irq(&current->sighand->siglock);
current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN;
+ flush_sigqueue_mask(&mask, &current->signal->shared_pending);
+ flush_sigqueue_mask(&mask, &current->pending);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
}
--
1.5.5.1


\
 
 \ /
  Last update: 2014-03-23 21:21    [W:0.083 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site