diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2015-03-02 17:36:02 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2015-03-02 17:36:02 +0000 |
commit | 9b281a9fd41a8a09ff6c9c1bf4cc13c1362533c8 (patch) | |
tree | 5964bb033a45d1b6b4738b9ca4f907328a3b5070 /lib/sanitizer_common/tests | |
parent | c1b43b1d4c26fabc2199640c9bcc613a8cbc1e6e (diff) |
asan: fix signal handling during stoptheworld
The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler.
Add SA_RESTORER flag when setting up handlers.
Add a test that causes SIGSEGV in stoptheworld callback.
Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread.
http://reviews.llvm.org/D8005
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/tests')
-rw-r--r-- | lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc b/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc index b6786ba8b..802af392c 100644 --- a/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc @@ -189,6 +189,16 @@ TEST(StopTheWorld, SuspendThreadsAdvanced) { pthread_mutex_destroy(&advanced_incrementer_thread_exit_mutex); } +static void SegvCallback(const SuspendedThreadsList &suspended_threads_list, + void *argument) { + *(volatile int*)0x1234 = 0; +} + +TEST(StopTheWorld, SegvInCallback) { + // Test that tracer thread catches SIGSEGV. + StopTheWorld(&SegvCallback, NULL); +} + } // namespace __sanitizer #endif // SANITIZER_LINUX && defined(__x86_64__) |