View Issue Details

IDProjectCategoryView StatusLast Update
0036880FPCRTLpublic2020-04-07 14:22
ReporterAnton Kavalenka Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0036880: rtl: TLS handling in FPC x86_64-linux RTL leads to crash
DescriptionOnly x86_64-linux

Run the attached test. Process loads 2 DLLs in main thread, calls one function in main thread.
Then thread is started, another function called (as it touches output file - it causes TLS reallocation).
Unloading DLLs before thread stopping leads to crash in posix_threads library.
Stopping threads before DLL unload works properly.
C++ DLL behaves propely in both ways.

C++ dll built in the following way:
g++ -shared -fPIC b.cpp -o libb.so
Steps To ReproduceRun the attached test.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Anton Kavalenka

2020-04-06 16:18

reporter  

tls_dll.zip (5,182 bytes)

Anton Kavalenka

2020-04-06 16:23

reporter   ~0121973

Thread 2 "project1" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7da1700 (LWP 26053)]
0x00007ffff5d3a6e0 in ?? ()
(gdb) bt
#0 0x00007ffff5d3a6e0 in ?? ()
0000001 0x00007ffff7f6d1a1 in __nptl_deallocate_tsd () at pthread_create.c:301
0000002 0x00007ffff7f6dfc4 in __nptl_deallocate_tsd () at pthread_create.c:256
0000003 start_thread (arg=<optimized out>) at pthread_create.c:497
0000004 0x00007ffff7e9e4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Issue History

Date Modified Username Field Change
2020-04-06 16:18 Anton Kavalenka New Issue
2020-04-06 16:18 Anton Kavalenka File Added: tls_dll.zip
2020-04-06 16:23 Anton Kavalenka Note Added: 0121973