llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.17k stars 12.03k forks source link

LeakSanitizer throws fatal error around std::async #35374

Open 24bb07d4-a064-4a64-856b-dc3103e7a3ac opened 6 years ago

24bb07d4-a064-4a64-856b-dc3103e7a3ac commented 6 years ago
Bugzilla Link 36026
Version 6.0
OS All
CC @eugenis,@vitalybuka

Extended Description

Hello,

I encounter the following leak sanitizer error on Ubuntu Bionic:

include

int main() { auto write = std::async(std::launch::async, []() {}); write.wait(); return 0; }

$ clang++-6.0 -fsanitize=address -o testcase testcase.cpp && ./testcase ==8777==LeakSanitizer has encountered a fatal error. ==8777==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1 ==8777==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

Environment:

Thanks, Gregor

Full Debug output with LSAN_OPTIONS=verbosity=1:log_threads=1

==8784==AddressSanitizer: libc interceptors initialized || [0x10007fff8000, 0x7fffffffffff] || HighMem || || [0x02008fff7000, 0x10007fff7fff] || HighShadow || || [0x00008fff7000, 0x02008fff6fff] || ShadowGap || || [0x00007fff8000, 0x00008fff6fff] || LowShadow || || [0x000000000000, 0x00007fff7fff] || LowMem || MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff redzone=16 max_redzone=2048 quarantine_size_mb=256M thread_local_quarantine_size_kb=1024K malloc_context_size=30 SHADOW_SCALE: 3 SHADOW_GRANULARITY: 8 SHADOW_OFFSET: 0x7fff8000 ==8784==Installed the sigaction for signal 11 ==8784==Installed the sigaction for signal 7 ==8784==Installed the sigaction for signal 8 ==8784==T0: stack [0x7fff2012a000,0x7fff2092a000) size 0x800000; local=0x7fff20928d88 ==8784==AddressSanitizer Init done ==8784==T1: stack [0x7f0e63aff000,0x7f0e642fef40) size 0x7fff40; local=0x7f0e642fee58 ==8784==T1 TSDDtor ==8784==T1 exited ==8786==Could not attach to thread 8784 (errno 1). ==8786==Failed suspending threads. ==8784==LeakSanitizer has encountered a fatal error. ==8784==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1 ==8784==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

24bb07d4-a064-4a64-856b-dc3103e7a3ac commented 6 years ago

Using asan with GCC 7.2 results in nearly the same error:

==10432==AddressSanitizer: failed to intercept 'isoc99_printf' ==10432==AddressSanitizer: failed to intercept '__isoc99_sprintf' ==10432==AddressSanitizer: failed to intercept 'isoc99_snprintf' ==10432==AddressSanitizer: failed to intercept 'isoc99_fprintf' ==10432==AddressSanitizer: failed to intercept '__isoc99_vprintf' ==10432==AddressSanitizer: failed to intercept 'isoc99_vsprintf' ==10432==AddressSanitizer: failed to intercept '__isoc99_vsnprintf' ==10432==AddressSanitizer: failed to intercept '__isoc99_vfprintf' ==10432==AddressSanitizer: libc interceptors initialized || [0x10007fff8000, 0x7fffffffffff] || HighMem || || [0x02008fff7000, 0x10007fff7fff] || HighShadow || || [0x00008fff7000, 0x02008fff6fff] || ShadowGap || || [0x00007fff8000, 0x00008fff6fff] || LowShadow || || [0x000000000000, 0x00007fff7fff] || LowMem || MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff redzone=16 max_redzone=2048 quarantine_size_mb=256M malloc_context_size=30 SHADOW_SCALE: 3 SHADOW_GRANULARITY: 8 SHADOW_OFFSET: 0x7fff8000 ==10432==Installed the sigaction for signal 11 ==10432==Installed the sigaction for signal 7 ==10432==Installed the sigaction for signal 8 ==10432==T0: stack [0x7ffc1d82d000,0x7ffc1e02d000) size 0x800000; local=0x7ffc1e02bad4 ==10432==LeakSanitizer: Dynamic linker not found. TLS will not be handled correctly. ==10432==AddressSanitizer Init done ==10432==T1: stack [0x7f6b7e4ff000,0x7f6b7ecfef40) size 0x7fff40; local=0x7f6b7ecfee54 ==10432==T1 TSDDtor ==10432==T1 exited ==10434==Could not attach to thread 10432 (errno 1). ==10434==Failed suspending threads. ==10432==LeakSanitizer has encountered a fatal error. ==10432==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1 ==10432==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)