mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.5.39: Signal delivery to thread groups: Bug or feature
@ 2002-09-28 17:15 Axel
  0 siblings, 0 replies; 6+ messages in thread
From: Axel @ 2002-09-28 17:15 UTC (permalink / raw)
  To: linux-kernel, phil-list

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <200209281638.g8SGcQi23877@mx1.redhat.com>]
* 2.5.39: Signal delivery to thread groups: Bug or feature
@ 2002-09-28 17:14 Axel
  0 siblings, 0 replies; 6+ messages in thread
From: Axel @ 2002-09-28 17:14 UTC (permalink / raw)
  To: linux-kernel, phil-list

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-09-29 16:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-28 17:15 2.5.39: Signal delivery to thread groups: Bug or feature Axel
     [not found] <200209281638.g8SGcQi23877@mx1.redhat.com>
2002-09-29  8:25 ` Ingo Molnar
2002-09-29 16:56   ` Axel
2002-09-29 10:27 ` Ingo Molnar
2002-09-29 10:47   ` Roland McGrath
  -- strict thread matches above, loose matches on Subject: below --
2002-09-28 17:14 Axel

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®