tsan: fix signal handling during stop-the-world
authorDmitry Vyukov <dvyukov@google.com>
Thu, 5 Mar 2015 14:37:28 +0000 (14:37 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Thu, 5 Mar 2015 14:37:28 +0000 (14:37 +0000)
commit72f169797e7c81fb9b40f764c9d129ff43e854d6
tree95125801f12b7be6c72c6b75627b710622f505ac
parent1725997f142ba456ee374c7b87a2d07cfdc9f1a8
tsan: fix signal handling during stop-the-world

Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

This is reincarnation of reverted r229678 (http://reviews.llvm.org/D7722).
Changed:
- execute TracerThreadDieCallback only on tracer thread
- reset global data in TracerThreadSignalHandler/TracerThreadDieCallback
- handle EINTR from waitpid

Add 3 new test:
- SIGSEGV during leak checking
- StopTheWorld operation during signal storm from an external process
- StopTheWorld operation when the program generates and handles SIGSEGVs

http://reviews.llvm.org/D8032

llvm-svn: 231367
compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h
compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cc [new file with mode: 0644]
compiler-rt/test/asan/TestCases/Linux/signal_during_stop_the_world.cc [new file with mode: 0644]
compiler-rt/test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc [new file with mode: 0644]