tsan: improve detection of stack/tls races
authorDmitry Vyukov <dvyukov@google.com>
Tue, 5 Oct 2021 13:26:02 +0000 (15:26 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Tue, 5 Oct 2021 13:32:39 +0000 (15:32 +0200)
commitc483140f3ce28ea243d414dd0dee0c0f13c5b01c
treebbdeef1dc9d21af4876346a33deb63c5c069ee68
parent070b0af9b813443a1db0550478389ba05f9820c8
tsan: improve detection of stack/tls races

Print meaningful stack frames for stack/tls races
(instead of PC 1/2 that don't symbolize).

Imitate stack/tls writes after we create and initialize
the new thread, otherwise the races are not detected.

This is re-submit of the following reverted commits,
but without tests as they failed on a number of OSes/arches:
"tsan: fix and test detection of TLS races"
"tsan: fix tls_race3 test on darwin"
"tsan: print a meaningful frame for stack races"

Differential Revision: https://reviews.llvm.org/D111147
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp