[Bug 784211] New: getaddrinfo() segfaults in a thread in a dlopen'd library if the main program is not linked against libpthread
https://bugzilla.novell.com/show_bug.cgi?id=784211 https://bugzilla.novell.com/show_bug.cgi?id=784211#c0 Summary: getaddrinfo() segfaults in a thread in a dlopen'd library if the main program is not linked against libpthread Classification: openSUSE Product: openSUSE Factory Version: 12.3 Milestone 0 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: gber@opensuse.org QAContact: qa-bugs@suse.de Found By: --- Blocker: --- Created an attachment (id=508704) --> (http://bugzilla.novell.com/attachment.cgi?id=508704) backtrace User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 getaddrinfo() segfaults when called from a thread in a dlopen'd library if main program is not linked against libpthread, when linking the main program against libpthread or preloading it the probelm disappears. I ran into this when using the curl multi interface through the tcl curl bindings, our tcl interpreter is built without thread support and dlopens the TclCurl library which is in turn linked against libcurl which uses pthreads for the multi interface. After looking into this I've created a minimal test case that I've attached together with a backtrace here. Reproducible: Always -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c1
--- Comment #1 from Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c2
--- Comment #2 from Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c3
Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c4
--- Comment #4 from Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c5
Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c6
Guido Berhörster
It does not crash for me.
Are you running nscd or unscd?
Stock 12.2 and Factory installs, unscd is installed but not running which seems to be the default. Segfaults every time on my quadcore, in a single-cpu kvm guest it's more difficult to reproduce but still occasionally segfaults as well. Try running it in a loop for a while: while ./atest; do :; done -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c7
--- Comment #7 from Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c8
--- Comment #8 from Guido Berhörster
Start nscd/unscd - does it still fail for you?
It only crashes for me if I stop nscd but works fine if nscd runs.
I've only done a quick check, but I haven't been able to reproduce the segfaults with nscd running. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c9
--- Comment #9 from Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c10
Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c11
Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c12
Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c13
--- Comment #13 from Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c14
--- Comment #14 from Guido Berhörster
BTW, is there no way to tell TclCurl not to use threads, even if libcurl was built with threads support?
Unfortunately using the libcurl multi interface there is no way to influence internal thread usage, it's an implementation detail that isn't even documented in curl AFAICT. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c15
Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c16
Guido Berhörster
The next openSUSE release will ship with Tcl 8.6 which has threads enabled by default.
I still would like to fix this for 12.2/12.3. How about forcibly building tcl against libpthread, that is not by enabling threads support but by simply putting "-pthread" into CFLAGS? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c17
Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c18
Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c19
Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c20
--- Comment #20 from Guido Berhörster
Packages for 12.2 and 12.3 are now in home:rmax:branches:OBS_Maintained:tcl . Please test.
Thanks. But shouldn't generally -pthread be used instead of -lpthread since the former also makes sure thread-safe glibc functions and data structures are used? Andreas? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c21
--- Comment #21 from Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c22
Guido Berhörster
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c23
Reinhard Max
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c24
--- Comment #24 from Bernhard Wiedemann
https://bugzilla.novell.com/show_bug.cgi?id=784211
https://bugzilla.novell.com/show_bug.cgi?id=784211#c25
--- Comment #25 from Swamp Workflow Management
participants (1)
-
bugzilla_noreply@novell.com