public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] signal: make group kill signal fatal
@ 2009-05-24 20:47 Jiri Slaby
  2009-05-25  0:07 ` Oleg Nesterov
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2009-05-24 20:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: ebiederm, oleg, roland, linux-kernel, Jiri Slaby, Matthew Wilcox

__fatal_signal_pending() returns now true only for a non-group sent
sigkill, i. e. for example tgkill, send_sig...

Use sigkill_pending() in __fatal_signal_pending() which adds a test also
for shared_pending queue.

Also grab siglock in __fatal_signal_pending().

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Matthew Wilcox <matthew@wil.cx>
---
 kernel/signal.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index e964ad9..a12897a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -116,6 +116,16 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 	return ready !=	0;
 }
 
+/*
+ * Return nonzero if there is a SIGKILL that should be waking us up.
+ * Called with the siglock held.
+ */
+static int sigkill_pending(struct task_struct *tsk)
+{
+	return	sigismember(&tsk->pending.signal, SIGKILL) ||
+		sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
+}
+
 #define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
@@ -1033,7 +1043,13 @@ void zap_other_threads(struct task_struct *p)
 
 int __fatal_signal_pending(struct task_struct *tsk)
 {
-	return sigismember(&tsk->pending.signal, SIGKILL);
+	int ret;
+
+	spin_lock_irq(&tsk->sighand->siglock);
+	ret = sigkill_pending(tsk);
+	spin_unlock_irq(&tsk->sighand->siglock);
+
+	return ret;
 }
 EXPORT_SYMBOL(__fatal_signal_pending);
 
@@ -1549,16 +1565,6 @@ static inline int may_ptrace_stop(void)
 }
 
 /*
- * Return nonzero if there is a SIGKILL that should be waking us up.
- * Called with the siglock held.
- */
-static int sigkill_pending(struct task_struct *tsk)
-{
-	return	sigismember(&tsk->pending.signal, SIGKILL) ||
-		sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
-}
-
-/*
  * This must be called with current->sighand->siglock held.
  *
  * This should be the path for all ptrace stops.
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-06-04  2:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-24 20:47 [PATCH 1/1] signal: make group kill signal fatal Jiri Slaby
2009-05-25  0:07 ` Oleg Nesterov
2009-05-25 16:21   ` Jiri Slaby
2009-05-25 17:20     ` Oleg Nesterov
2009-05-25 18:15       ` Jiri Slaby
2009-05-25 22:51         ` Oleg Nesterov
2009-06-02 12:54           ` Jiri Slaby
2009-06-02 14:50             ` Oleg Nesterov
2009-06-03  1:52               ` Roland McGrath
2009-06-04  2:27                 ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox