public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Thorsten Kukuk <kukuk@suse.de>
Cc: Steve Munroe <sjmunroe@us.ibm.com>, libc-hacker@sources.redhat.com
Subject: Re: deadlock in signal handler with NPTL
Date: Wed, 23 Jun 2004 08:23:00 -0000	[thread overview]
Message-ID: <20040623060853.GL5191@sunsite.ms.mff.cuni.cz> (raw)
In-Reply-To: <20040623065635.GA21813@suse.de>

On Wed, Jun 23, 2004 at 08:56:35AM +0200, Thorsten Kukuk wrote:
> > I have reviewed all the changes to
> > lowlevellock.h since and I do not see any change that would effect this. In
> > fact your test case should show that same hang there.
> 
> The difference is: glibc with linuxthreads compiled only uses the
> locking, if the program is linked against pthread.
> 
> glibc with NPTL compiled always uses locking (__libc_lock_lock always
> calls lll_lock).
> 
> Uli, Jakub, is this really necessary? Wouldn't it be better to add the
> one extra compare?

This is done on purpose.  We are not going to sacrifice speed for the sake
of a few broken apps which work with linuxthreads by pure luck.
The reasons are actually both speed and being able to dlopen libpthread.so.
When syslog enters its critical section by __libc_lock_lock (syslog_lock);,
it really assumes that it is alone there, if it knew it can handle the
critical section being entered recursively, it could use
__libc_lock_lock_recursive instead (at which point your testcase would
probably work, unless there are other problem places).
But the code is clearly not prepared for that.
So, when the locks are nop in linuxthreads, e.g. openlog might be done
twice, or the outer syslog might believe it is connected while the inner
syslog closed it and similar problems.

	Jakub

      reply	other threads:[~2004-06-23  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 21:51 Thorsten Kukuk
2004-06-22 22:07 ` Jakub Jelinek
2004-06-23  4:26   ` Thorsten Kukuk
2004-06-23  4:41     ` Steve Munroe
2004-06-23  6:56       ` Thorsten Kukuk
2004-06-23  8:23         ` Jakub Jelinek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040623060853.GL5191@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=kukuk@suse.de \
    --cc=libc-hacker@sources.redhat.com \
    --cc=sjmunroe@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).