mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: ebiederm@xmission.com, oleg@tv-sign.ru, roland@redhat.com,
	linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
	Matthew Wilcox <matthew@wil.cx>
Subject: [PATCH 1/1] signal: make group kill signal fatal
Date: Sun, 24 May 2009 22:47:34 +0200	[thread overview]
Message-ID: <1243198054-13816-1-git-send-email-jirislaby@gmail.com> (raw)

__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


             reply	other threads:[~2009-05-24 20:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24 20:47 Jiri Slaby [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243198054-13816-1-git-send-email-jirislaby@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®