Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756570AbXFKWT2 (ORCPT ); Mon, 11 Jun 2007 18:19:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753377AbXFKWTV (ORCPT ); Mon, 11 Jun 2007 18:19:21 -0400 Received: from gate.crashing.org ([63.228.1.57]:32820 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbXFKWTU (ORCPT ); Mon, 11 Jun 2007 18:19:20 -0400 Subject: Re: [BUG] ptraced process waiting on syscall may return kernel internal errnos From: Benjamin Herrenschmidt To: Linus Torvalds Cc: Satoru Takeuchi , Roland McGrath , Andrew Morton , Linux Kernel , Oleg Nesterov , davidel@xmailserver.org In-Reply-To: References: <20070606105900.DE5E94D0592@magilla.localdomain> <87sl949eyx.wl%takeuchi_satoru@jp.fujitsu.com> <1181255068.14818.77.camel@localhost.localdomain> Content-Type: text/plain Date: Tue, 12 Jun 2007 08:16:18 +1000 Message-Id: <1181600178.14818.237.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1334 Lines: 38 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 --- Davide asked me to re-send this one. So here it is. Index: linux-work/kernel/signal.c =================================================================== --- linux-work.orig/kernel/signal.c 2007-06-08 15:28:00.000000000 +1000 +++ linux-work/kernel/signal.c 2007-06-08 15:28:44.000000000 +1000 @@ -363,7 +363,13 @@ static int __dequeue_signal(struct sigpe */ 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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/