Fix signalfd interaction with thread-private signals
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 11 Jun 2007 22:16:18 +0000 (08:16 +1000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 18 Jun 2007 17:18:32 +0000 (10:18 -0700)
Don't let signalfd dequeue private signals off other threads (in the
case of things like SIGILL or SIGSEGV, trying to do so would result
in undefined behaviour on who actually gets the signal, since they
are force unblocked).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/signal.c

index fe590e00db8df24823280b0bbf94a1daead4cfb5..f9405609774eadc4115006e8f80f418413d84217 100644 (file)
@@ -363,7 +363,13 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
  */
 int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
 {
-       int signr = __dequeue_signal(&tsk->pending, mask, info);
+       int signr = 0;
+
+       /* We only dequeue private signals from ourselves, we don't let
+        * signalfd steal them
+        */
+       if (tsk == current)
+               signr = __dequeue_signal(&tsk->pending, mask, info);
        if (!signr) {
                signr = __dequeue_signal(&tsk->signal->shared_pending,
                                         mask, info);