deadlock in signal handler with NPTL

Jakub Jelinek jakub@redhat.com
Tue Jun 22 22:07:00 GMT 2004


On Tue, Jun 22, 2004 at 11:50:59PM +0200, Thorsten Kukuk wrote:
> 
> Hi,
> 
> I got the following test program. I know, it is very ugly and there
> are a lot of things somebody should not do, but this is something
> what programs like sshd are doing.

Then they should be fixed.  Neither syslog, nor printf, nor fflush
are supposed to be async-signal safe, nor they actually are in glibc.

> The problem is: This program deadlocks very fast in a FUTEX_WAIT
> call. This does not happen with LinuxThreads.

Try linking the program with -lpthread and retry with LinuxThreads.
It will hang the same way.
The thing is that NPTL uses locking (on IA-32/x86-64 without lock prefix)
even when -lpthread has not been linked in.

	Jakub



More information about the Libc-hacker mailing list