Bug 58819

Summary: Jammed: Clang's ThreadSanitizer, Mono and make
Product: [Mono] Runtime Reporter: Armin <prince.cherusker>
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: NEW ---    
Severity: normal CC: bernhard.urban, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Stack traces

Description Armin 2017-08-16 16:04:18 UTC
Created attachment 24245 [details]
Stack traces

When building Mono with the ThreadSanitizer's injected functions, `make` never completes; as soon as it gets to the part where Roslyn tries to build the dlls, the runtime gets stuck. The corresponding (captured) stack traces of all threads during such a jam can be found attached.

The following code reproduces this issue reliably:

$ git clean -xffd
$ ./autogen.sh --prefix=/usr/local CC=clang CFLAGS="-fsanitize=thread" LDFLAGS=-fsanitize=thread CXX=clang++
$ make
$ # wait until mscorlib.dll has been built successfully (sometimes even mscorlib.dll does not complete, however most of the times it does) ...
Comment 1 Bernhard Urban 2017-08-16 18:00:09 UTC
I suspect that TSan messes around with our signal handler in some way. For reference: https://github.com/llvm-mirror/compiler-rt/blob/f728f46988ea1fc5c921dfdf53eea02a1050f80e/lib/tsan/rtl/tsan_interceptors.cc#L1823