[PATCH] D32443: [asan] Change default of allow_user_segv_handler to true
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 23:29:44 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303842: [compiler-rt] Change default of allow_user_segv_handler to true (authored by vitalybuka).
Repository:
rL LLVM
https://reviews.llvm.org/D32443
Files:
compiler-rt/trunk/lib/asan/scripts/asan_device_setup
compiler-rt/trunk/lib/asan/tests/asan_test.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
Index: compiler-rt/trunk/lib/asan/tests/asan_test.cc
===================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc
@@ -251,38 +251,43 @@
namespace {
const char kSEGVCrash[] = "AddressSanitizer: SEGV on unknown address";
-const char kOverriddenHandler[] = "ASan signal handler has been overridden\n";
+const char kOverriddenSigactionHandler[] = "Test sigaction handler\n";
+const char kOverriddenSignalHandler[] = "Test signal handler\n";
TEST(AddressSanitizer, WildAddressTest) {
char *c = (char*)0x123;
EXPECT_DEATH(*c = 0, kSEGVCrash);
}
void my_sigaction_sighandler(int, siginfo_t*, void*) {
- fprintf(stderr, kOverriddenHandler);
+ fprintf(stderr, kOverriddenSigactionHandler);
exit(1);
}
void my_signal_sighandler(int signum) {
- fprintf(stderr, kOverriddenHandler);
+ fprintf(stderr, kOverriddenSignalHandler);
exit(1);
}
TEST(AddressSanitizer, SignalTest) {
struct sigaction sigact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_sigaction = my_sigaction_sighandler;
sigact.sa_flags = SA_SIGINFO;
- // ASan should silently ignore sigaction()...
+ char *c = (char *)0x123;
+
+ EXPECT_DEATH(*c = 0, kSEGVCrash);
+
+ // ASan should allow to set sigaction()...
EXPECT_EQ(0, sigaction(SIGSEGV, &sigact, 0));
#ifdef __APPLE__
EXPECT_EQ(0, sigaction(SIGBUS, &sigact, 0));
#endif
- char *c = (char*)0x123;
- EXPECT_DEATH(*c = 0, kSEGVCrash);
+ EXPECT_DEATH(*c = 0, kOverriddenSigactionHandler);
+
// ... and signal().
- EXPECT_EQ(0, signal(SIGSEGV, my_signal_sighandler));
- EXPECT_DEATH(*c = 0, kSEGVCrash);
+ EXPECT_NE(SIG_ERR, signal(SIGSEGV, my_signal_sighandler));
+ EXPECT_DEATH(*c = 0, kOverriddenSignalHandler);
}
} // namespace
#endif
Index: compiler-rt/trunk/lib/asan/scripts/asan_device_setup
===================================================================
--- compiler-rt/trunk/lib/asan/scripts/asan_device_setup
+++ compiler-rt/trunk/lib/asan/scripts/asan_device_setup
@@ -327,11 +327,6 @@
EOF
}
-# On Android-L not allowing user segv handler breaks some applications.
-if [[ PRE_L -eq 0 ]]; then
- ASAN_OPTIONS="$ASAN_OPTIONS,allow_user_segv_handler=1"
-fi
-
if [[ x$extra_options != x ]] ; then
ASAN_OPTIONS="$ASAN_OPTIONS,$extra_options"
fi
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
@@ -92,7 +92,7 @@
COMMON_FLAG(HandleSignalMode, handle_sigfpe, kHandleSignalYes,
COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGFPE))
#undef COMMON_FLAG_HANDLE_SIGNAL_HELP
-COMMON_FLAG(bool, allow_user_segv_handler, false,
+COMMON_FLAG(bool, allow_user_segv_handler, true,
"If set, allows user to register a SEGV handler even if the tool "
"registers one.")
COMMON_FLAG(bool, use_sigaltstack, true,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32443.100208.patch
Type: text/x-patch
Size: 3040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/caf36b2b/attachment.bin>
More information about the llvm-commits
mailing list