From: Benjamin Herrenschmidt Date: Mon, 11 Jun 2007 22:16:18 +0000 (+1000) Subject: Fix signalfd interaction with thread-private signals X-Git-Tag: v2.6.22-rc6~91 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caec4e8dc85e0644ec24aeb36285e1ba02da58cc;p=linux-2.6 Fix signalfd interaction with thread-private signals 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 Acked-by: Davide Libenzi Signed-off-by: Linus Torvalds --- diff --git a/kernel/signal.c b/kernel/signal.c index fe590e00db..f940560977 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -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);