Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 28 Sep 2002 12:51:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 28 Sep 2002 12:51:26 -0400 Received: from sproxy.gmx.de ([213.165.64.20]:42237 "HELO mail.gmx.net") by vger.kernel.org with SMTP id ; Sat, 28 Sep 2002 12:51:25 -0400 Content-Type: text/plain; charset=US-ASCII From: Axel Reply-To: Axel.Zeuner@gmx.de To: linux-kernel@vger.kernel.org, phil-list@redhat.com Subject: 2.5.39: Signal delivery to thread groups: Bug or feature Date: Sat, 28 Sep 2002 19:15:53 +0200 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Message-Id: <20020928165125Z262210-8741+605@vger.kernel.org> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1694 Lines: 32 Hello, I played a little bit with the new clone flags and wrote a small test program using two threads: The first (initial) thread blocks all signals. The second thread is created with all signals blocked and inherits the signal mask of the initial thread. It unblocks SIGINT and calls sys_rt_sigtimedwait with the remaining signal mask. Therefore it waits for all signals with exception of SIGINT. In the kernel this yields to an empty signal mask for this thread during the sigwait. No signal handler is installed by the process. Now an external SIGINT is delivered to the whole process: The signal delivery code decides to send this signal directly to the initial thread because no user handler is installed and the signal mask for this thread blocks the signal. The second thread never receives the SIGINT. Reason: The main signal dispatching function send_sig_info in kernel/signal.c requires at the moment an installed signal handler for delivery of signals to members of the thread group. Therefore NPTL/NPT must install signal handlers for all signals during startup to allow signal delivery to other threads and must restore these default handlers to SIG_DFL after first delivery and raise the signal to create the correct exit code. IMHO, the current signal system is not a clean solution (yet), but of course much better than the ugly signal forwarding required by the thread group leader only working as signal thread in 2.4.X. Axel - 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/