digitalmars.D.bugs - [Issue 17588] New: SIGSEGV in pthread_mutex_destroy on a shared
- via Digitalmars-d-bugs (60/60) Jul 03 2017 https://issues.dlang.org/show_bug.cgi?id=17588
https://issues.dlang.org/show_bug.cgi?id=17588 Issue ID: 17588 Summary: SIGSEGV in pthread_mutex_destroy on a shared library executable (with -pie) Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: timothee.cour2 gmail.com a main program running dlopen/dlclose on a shared library executable (with -pie) generates a SEGFAULT on program termination: ``` dmd --version DMD64 D Compiler v2.074.1 FLAGS_link=-L~/dmd2_074_1/linux/lib64/,-rpath=~/dmd2_074_1/linux/lib64/,-lphobos2 dmd -offoo.o -c -fPIC foo.d /usr/bin/g++ -o libfoo foo.o -pie -Wl,$FLAGS_link,--export-dynamic foo.d: void main(){} main.d: void main(){ string file=`libfoo`; import core.sys.posix.dlfcn; import std.string:toStringz; auto flag=RTLD_LAZY | RTLD_LOCAL; auto handle=dlopen(file.toStringz, flag); assert(handle); int ret=dlclose(handle); assert(!ret); import std.stdio; writeln("ok"); // segfaults before process executes } dmd -run main.d #SEGFAULT ``` Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7bc36b1 in pthread_mutex_destroy () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) bt /lib/x86_64-linux-gnu/libpthread.so.0 () _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFNlMDFZvZv () /lib/x86_64-linux-gnu/libc.so.6 ``` --
Jul 03 2017