This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem with syslog, libpthread and dlopen


Some Debian users have been reporting problems with syslog() blocking
forever when an object that's linked against libpthread has been
previously loaded with dlopen.  If the main program is linked with
-lpthread directly, or it's loaded with LD_PRELOAD, the bug does not
occur.

What seems to happen is that the __libc_cleanup_push and
__libc_cleanup_pop calls in openlog() have no effect, because libc's GOT
entries for _pthread_cleanup_push and _pthread_cleanup_pop are set to
NULL.  But the call to __libc_lock_lock goes via
__libc_pthread_functions, which has now been initialized, so openlog()
returns with the lock still held.  Then the next call to a syslog
function attempts to claim the lock a second time, and deadlock ensues.

A testcase is at:
http://lists.debian.org/debian-glibc/2003/debian-glibc-200309/msg00310.html

What's the right way to fix this?  Should _pthread_cleanup_push/pop be
called through __libc_pthread_functions as well?

Thanks

p.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]