aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-06-06 17:36:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:12 -0400
commit580d34e42ad621736a3c53c9c11a2152c18a4068 (patch)
tree2f2b6b11a8ad3e031116932c196b1cd3727934cc /kernel/signal.c
parentec5955b8fdc1b0bc62495e13869769be732cc6c3 (diff)
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> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Richard Weinberger <richard@nod.at> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index c64c891ca0a6..3ec405132c79 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3085,8 +3085,15 @@ EXPORT_SYMBOL(allow_signal);
3085 3085
3086void disallow_signal(int sig) 3086void disallow_signal(int sig)
3087{ 3087{
3088 sigset_t mask;
3089
3090 sigemptyset(&mask);
3091 sigaddset(&mask, sig);
3092
3088 spin_lock_irq(&current->sighand->siglock); 3093 spin_lock_irq(&current->sighand->siglock);
3089 current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN; 3094 current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN;
3095 flush_sigqueue_mask(&mask, &current->signal->shared_pending);
3096 flush_sigqueue_mask(&mask, &current->pending);
3090 recalc_sigpending(); 3097 recalc_sigpending();
3091 spin_unlock_irq(&current->sighand->siglock); 3098 spin_unlock_irq(&current->sighand->siglock);
3092} 3099}