[PATCH] D32444: [asan] Rename allow_user_segv_handler into allow_user_sig_handler
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 10:36:55 PDT 2017
vitalybuka created this revision.
Herald added a subscriber: kubamracek.
allow_user_segv_handler already control various signals, not
just SEGV
https://reviews.llvm.org/D32444
Files:
lib/asan/asan_interceptors.cc
lib/asan/asan_win.cc
lib/sanitizer_common/sanitizer_flags.inc
test/asan/TestCases/Posix/allow_user_segv.cc
test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
Index: test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
===================================================================
--- test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
+++ test/sanitizer_common/TestCases/Linux/signal_segv_handler.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx -O1 %s -o %t && TSAN_OPTIONS="flush_memory_ms=1 memory_limit_mb=1" ASAN_OPTIONS="handle_segv=0 allow_user_segv_handler=1" %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O1 %s -o %t && TSAN_OPTIONS="flush_memory_ms=1 memory_limit_mb=1" ASAN_OPTIONS="handle_segv=0 allow_user_signal_handler=1" %run %t 2>&1 | FileCheck %s
// JVM uses SEGV to preempt threads. All threads do a load from a known address
// periodically. When runtime needs to preempt threads, it unmaps the page.
Index: test/asan/TestCases/Posix/allow_user_segv.cc
===================================================================
--- test/asan/TestCases/Posix/allow_user_segv.cc
+++ test/asan/TestCases/Posix/allow_user_segv.cc
@@ -1,8 +1,8 @@
// Regression test for
// https://code.google.com/p/address-sanitizer/issues/detail?id=180
-// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=allow_user_segv_handler=true not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %s -o %t && %env_asan_opts=allow_user_segv_handler=true not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=allow_user_signal_handler=true not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %s -o %t && %env_asan_opts=allow_user_signal_handler=true not %run %t 2>&1 | FileCheck %s
#include <signal.h>
#include <stdio.h>
Index: lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- lib/sanitizer_common/sanitizer_flags.inc
+++ lib/sanitizer_common/sanitizer_flags.inc
@@ -88,8 +88,8 @@
"If set, registers the tool's custom SIGILL handler.")
COMMON_FLAG(bool, handle_sigfpe, true,
"If set, registers the tool's custom SIGFPE handler.")
-COMMON_FLAG(bool, allow_user_segv_handler, true,
- "If set, allows user to register a SEGV handler even if the tool "
+COMMON_FLAG(bool, allow_user_signal_handler, true,
+ "If set, allows user to register a signal handler even if the tool "
"registers one.")
COMMON_FLAG(bool, use_sigaltstack, true,
"If set, uses alternate stack for signal handling.")
Index: lib/asan/asan_win.cc
===================================================================
--- lib/asan/asan_win.cc
+++ lib/asan/asan_win.cc
@@ -80,8 +80,10 @@
INTERCEPTOR_WINAPI(LPTOP_LEVEL_EXCEPTION_FILTER, SetUnhandledExceptionFilter,
LPTOP_LEVEL_EXCEPTION_FILTER ExceptionFilter) {
CHECK(REAL(SetUnhandledExceptionFilter));
- if (ExceptionFilter == &SEHHandler || common_flags()->allow_user_segv_handler)
+ if (ExceptionFilter == &SEHHandler ||
+ common_flags()->allow_user_signal_handler) {
return REAL(SetUnhandledExceptionFilter)(ExceptionFilter);
+ }
// We record the user provided exception handler to be called for all the
// exceptions unhandled by asan.
Swap(ExceptionFilter, user_seh_handler);
Index: lib/asan/asan_interceptors.cc
===================================================================
--- lib/asan/asan_interceptors.cc
+++ lib/asan/asan_interceptors.cc
@@ -351,25 +351,25 @@
#if SANITIZER_ANDROID
INTERCEPTOR(void*, bsd_signal, int signum, void *handler) {
if (!IsHandledDeadlySignal(signum) ||
- common_flags()->allow_user_segv_handler) {
+ common_flags()->allow_user_signal_handler) {
return REAL(bsd_signal)(signum, handler);
}
return 0;
}
#endif
INTERCEPTOR(void*, signal, int signum, void *handler) {
if (!IsHandledDeadlySignal(signum) ||
- common_flags()->allow_user_segv_handler) {
+ common_flags()->allow_user_signal_handler) {
return REAL(signal)(signum, handler);
}
return nullptr;
}
INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
struct sigaction *oldact) {
if (!IsHandledDeadlySignal(signum) ||
- common_flags()->allow_user_segv_handler) {
+ common_flags()->allow_user_signal_handler) {
return REAL(sigaction)(signum, act, oldact);
}
return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32444.96425.patch
Type: text/x-patch
Size: 4272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170424/dfaef3a5/attachment.bin>
More information about the llvm-commits
mailing list