2018-01-23 17:44 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0014273CentOS-7mesapublic2018-01-03 05:27
Reportercjstimpson 
PrioritynormalSeveritycrashReproducibilityalways
StatusnewResolutionopen 
PlatformLinuxOSCentOSOS Version7
Product Version 
Target VersionFixed in Version 
Summary0014273: segfault combining mesa/llvm with std::packaged_task
DescriptionI get a segfault when I combine mesa/llvm with some std::thread and std::packaged_task code.

Additionally, some of the code if found in a shared library which is loaded at runtime with dlopen(). LLVM is also loaded with dlopen().

Steps To Reproduceg++ -g -shared -fPIC -std=c++11 -o libtask.so src/task.cpp src/ThreadPool.cpp -lpthread
g++ -g -std=c++11 src/main.cpp -lpthread -lGL -lX11 -ldl

./a.out

# get a segfault
Additional Information
Running a.out gives the following results:
start
ctx = 0x22b1fa0
Segmentation fault (core dumped)


catchsegv ./a.out gives the following backtrace:
Backtrace:
/lib64/libLLVM-3.9-mesa.so(_ZSt16__once_call_implISt12_Bind_simpleIFSt7_Mem_fnIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS2_12_Result_baseENS6_8_DeleterEEvEERbEEPS3_St17reference_wrapperISA_ESH_IbEEEEvv+0x17)[0x7f7999d5d337]
/lib64/libpthread.so.0(pthread_once+0x50)[0x7f79a090ee20]
./libtask.so(+0x23e7d)[0x7f799cbd1e7d]
./libtask.so(_ZSt9call_onceIMNSt13__future_base11_State_baseEFvRSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEERbEJKPS1_St17reference_wrapperIS8_ESF_IbEEEvRSt9once_flagOT_DpOT0_+0xb9)[0x7f799cbd4a09]
./libtask.so(_ZNSt13__future_base11_State_base13_M_set_resultESt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEb+0x86)[0x7f799cbd3fb4]
./libtask.so(+0x25059)[0x7f799cbd3059]
./libtask.so(_ZNSt13packaged_taskIFvvEEclEv+0x47)[0x7f799cbd9a1d]
./libtask.so(_ZN10ThreadPool11task_holderISt13packaged_taskIFvvEEE7executeEv+0x1c)[0x7f799cbd9870]
./libtask.so(_ZN10ThreadPool10thread_runEPS_+0x59)[0x7f799cbda3db]
./libtask.so(_ZNSt12_Bind_simpleIFPFvP10ThreadPoolES1_EE9_M_invokeIILm0EEEEvSt12_Index_tupleIIXspT_EEE+0x40)[0x7f799cbdcfac]
./libtask.so(_ZNSt12_Bind_simpleIFPFvP10ThreadPoolES1_EEclEv+0x1b)[0x7f799cbdceb7]
./libtask.so(_ZNSt6thread5_ImplISt12_Bind_simpleIFPFvP10ThreadPoolES3_EEE6_M_runEv+0x1c)[0x7f799cbdce50]
/lib64/libstdc++.so.6(+0xb52b0)[0x7f799fefb2b0]
/lib64/libpthread.so.0(+0x7e25)[0x7f79a0909e25]
/lib64/libc.so.6(clone+0x6d)[0x7f799f66334d]


It looks like a conflict with C++ symbols found in libLLVM-3.9-mesa.so.

There are a few workarounds for this simple example:
1. LD_PRELOAD=./libtask.so
2. LD_PRELOAD=/lib64/libLLVM-3.9-mesa.so
3. re-arrange code in main.cpp to load libtask.so and call task_thread() before calling any mesa functions.

Possibly similar reports:
https://root-forum.cern.ch/t/llvm-collision-with-opengl-in-centos7/21979

https://github.com/conda-forge/conda-forge.github.io/issues/388

https://bugzilla.redhat.com/show_bug.cgi?id=1417663


I see this problem only on CentOS 7. I do not see it on Fedora 26, or CentOS 6 using devtoolset-1.1.
TagsNo tags attached.
abrt_hash
URL
Attached Files
  • tar file icon src.tar (10,240 bytes) 2017-12-14 17:35
  • tar file icon src-2.tar (10,240 bytes) 2018-01-03 05:15

-Relationships
+Relationships

-Notes

~0030846

cjstimpson (reporter)

src-2.tar contains simpler code illustrating the bug.
compile commands are:
g++ -g -std=c++11 -shared -fPIC -o libtask.so src/task.cpp -lpthread
g++ -g -std=c++11 src/main.cpp -lpthread -lGL -lX11 -ldl

The relevant parts of the backtrace on the segfaulting thread are still identical.
I'm still confused why my code is calling into leaked? symbols from libLLVM-3.9-mesa.so, and segfaulting.

The similar reports listed above include things like ones own build of libstdc++ and other complex situations. My situation is relatively simple, relying only on system provided compilers and libraries, but with the use of dlopen().
+Notes

-Issue History
Date Modified Username Field Change
2017-12-14 17:35 cjstimpson New Issue
2017-12-14 17:35 cjstimpson File Added: src.tar
2018-01-03 05:15 cjstimpson File Added: src-2.tar
2018-01-03 05:27 cjstimpson Note Added: 0030846
+Issue History