[DragonFlyBSD - Bug #2395] pkgsrc's intl library segfaults when locking a thread (i386 only)

Markus Pfeiffer via Redmine bugtracker-admin at leaf.dragonflybsd.org
Sat Mar 16 17:55:55 PDT 2013


Issue #2395 has been updated by profmakx.


What happens is that the constructor of libpthread is not called early enough on program startup. I have implemented a quick hack that makes the segfault go away, but I want to explore more closely the interactions between gcc 4.4 and 4.7 and the segfault and find a better fix. Simon suggested to initialise libpthread during libc initialisation.
----------------------------------------
Bug #2395: pkgsrc's intl library segfaults when locking a thread (i386 only)
http://bugs.dragonflybsd.org/issues/2395

Author: marino
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 


#### DOES NOT AFFECT X86_64, THIS IS I386 ONLY ####

How it was found:
pkgsrc security/libpreludedb wouldn't build, crashed during configuration.
Cause of crash was conftest involving libprelude-config, a program built from security/libprelude.

The program is attached.  It could be built with the following flags:
     cc -o conftest -O2 -g -I/usr/pkg/include -z relro -z now \
      -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lprelude -lgnutls -lgcrypt -lgpg-error conftest.c

Upon execution, it will segfault with libgcrypt which calls libgpg-error.
libgpg-error, when built with Native Language Support, will invoke bindtextdomain() from libintl (from pkgsrc devel/gettext-lib)
It should be bindtextdomain("libgpg-error", "/usr/pkg/share/locale").
That invocation from gpg-error's init function segfaults when locking a thread.

The backtrace is as follows:

Program received signal SIGSEGV, Segmentation fault.
init_static (thread=0x0, rwlock=0x284da28c)
    at /usr/src/lib/libthread_xu/thread/thr_rwlock.c:117
117		THR_LOCK_ACQUIRE(thread, &_rwlock_static_lock);
#0  init_static (thread=0x0, rwlock=0x284da28c)
    at /usr/src/lib/libthread_xu/thread/thr_rwlock.c:117
#1  0x284c7612 in rwlock_wrlock_common (rwlock=<optimized out>, 
    abstime=<optimized out>)
    at /usr/src/lib/libthread_xu/thread/thr_rwlock.c:363
#2  0x284c76dc in _pthread_rwlock_wrlock (rwlock=0x284da28c)
    at /usr/src/lib/libthread_xu/thread/thr_rwlock.c:403
#3  0x284d3652 in set_binding_values (domainname=0x282e9bd6 "libgpg-error", 
    dirnamep=0x284da28c, codesetp=0x0) at ./bindtextdom.c:94
#4  0x284d3a48 in libintl_bindtextdomain (
    domainname=0x282e9bd6 "libgpg-error", 
    dirname=0x282e9bc0 "/usr/pkg/share/locale") at ./bindtextdom.c:323
#5  0x282e974a in real_init () at init.c:68
#6  gpg_err_init () at init.c:104
#7  0x282e9b8b in __do_global_ctors_aux () from /usr/pkg/lib/libgpg-error.so.0
#8  0x282e956d in _init () from /usr/pkg/lib/libgpg-error.so.0
#9  0x28060288 in ?? () from /usr/libexec/ld-elf.so.2
#10 0x28054be8 in _rtld_call_init () at /usr/src/libexec/rtld-elf/rtld.c:738
#11 0x080485f0 in _start1 (cleanup=0x28056894 <rtld_exit>, argc=1, 
    argv=0xbfbff850) at /usr/src/lib/csu/i386/crt1_c.c:71
#12 0x08048598 in _start () at /usr/src/lib/csu/i386/crt1_s.S:46


The problem is problem with pthread library given libintl works on x86_64 and probably every platform supported by pkgsrc.


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list