Commit 1fac51a8 authored by Eric Holk's avatar Eric Holk Committed by Commit Bot

[trap handler] verify signal handler successfully installed on sanitizer builds

Bug: chromium:813376
Change-Id: I7d32f2ea09f7e8a4b75b9826695e129adac69e50
Reviewed-on: https://chromium-review.googlesource.com/987628
Commit-Queue: Eric Holk <eholk@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52495}
parent b5757ce5
...@@ -255,6 +255,26 @@ bool RegisterDefaultSignalHandler() { ...@@ -255,6 +255,26 @@ bool RegisterDefaultSignalHandler() {
return false; return false;
} }
// Sanitizers often prevent us from installing our own signal handler. Attempt
// to detect this and if so, refuse to enable trap handling.
//
// TODO(chromium:830894): Remove this once all bots support custom signal
// handlers.
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
defined(THREAD_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(UNDEFINED_SANITIZER)
struct sigaction installed_handler;
CHECK_EQ(sigaction(SIGSEGV, NULL, &installed_handler), 0);
// If the installed handler does not point to HandleSignal, then
// allow_user_segv_handler is 0.
if (installed_handler.sa_sigaction != HandleSignal) {
printf(
"WARNING: sanitizers are preventing signal handler installation. "
"Trap handlers are disabled.");
return false;
}
#endif
g_is_default_signal_handler_registered = true; g_is_default_signal_handler_registered = true;
return true; return true;
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment