[compiler-rt] r303481 - Revert "[compiler-rt] Change default of allow_user_segv_handler to true"
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 19:09:25 PDT 2017
Author: vitalybuka
Date: Fri May 19 21:09:25 2017
New Revision: 303481
URL: http://llvm.org/viewvc/llvm-project?rev=303481&view=rev
Log:
Revert "[compiler-rt] Change default of allow_user_segv_handler to true"
Failed libFuzzer tests on Windows.
This reverts commit r303476.
Modified:
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
Modified: compiler-rt/trunk/lib/asan/scripts/asan_device_setup
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_device_setup?rev=303481&r1=303480&r2=303481&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/scripts/asan_device_setup (original)
+++ compiler-rt/trunk/lib/asan/scripts/asan_device_setup Fri May 19 21:09:25 2017
@@ -327,6 +327,11 @@ exec $_to \$@
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
Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=303481&r1=303480&r2=303481&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Fri May 19 21:09:25 2017
@@ -251,8 +251,7 @@ TEST(AddressSanitizer, BitFieldNegativeT
namespace {
const char kSEGVCrash[] = "AddressSanitizer: SEGV on unknown address";
-const char kOverriddenSigactionHandler[] = "Test sigaction handler\n";
-const char kOverriddenSignalHandler[] = "Test signal handler\n";
+const char kOverriddenHandler[] = "ASan signal handler has been overridden\n";
TEST(AddressSanitizer, WildAddressTest) {
char *c = (char*)0x123;
@@ -260,12 +259,12 @@ TEST(AddressSanitizer, WildAddressTest)
}
void my_sigaction_sighandler(int, siginfo_t*, void*) {
- fprintf(stderr, kOverriddenSigactionHandler);
+ fprintf(stderr, kOverriddenHandler);
exit(1);
}
void my_signal_sighandler(int signum) {
- fprintf(stderr, kOverriddenSignalHandler);
+ fprintf(stderr, kOverriddenHandler);
exit(1);
}
@@ -274,20 +273,16 @@ TEST(AddressSanitizer, SignalTest) {
memset(&sigact, 0, sizeof(sigact));
sigact.sa_sigaction = my_sigaction_sighandler;
sigact.sa_flags = SA_SIGINFO;
- char *c = (char *)0x123;
-
- EXPECT_DEATH(*c = 0, kSEGVCrash);
-
- // ASan should allow to set sigaction()...
+ // ASan should silently ignore sigaction()...
EXPECT_EQ(0, sigaction(SIGSEGV, &sigact, 0));
#ifdef __APPLE__
EXPECT_EQ(0, sigaction(SIGBUS, &sigact, 0));
#endif
- EXPECT_DEATH(*c = 0, kOverriddenSigactionHandler);
-
+ char *c = (char*)0x123;
+ EXPECT_DEATH(*c = 0, kSEGVCrash);
// ... and signal().
- EXPECT_NE(SIG_ERR, signal(SIGSEGV, my_signal_sighandler));
- EXPECT_DEATH(*c = 0, kOverriddenSignalHandler);
+ EXPECT_EQ(0, signal(SIGSEGV, my_signal_sighandler));
+ EXPECT_DEATH(*c = 0, kSEGVCrash);
}
} // namespace
#endif
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc?rev=303481&r1=303480&r2=303481&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc Fri May 19 21:09:25 2017
@@ -92,7 +92,7 @@ COMMON_FLAG(HandleSignalMode, handle_sig
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, true,
+COMMON_FLAG(bool, allow_user_segv_handler, false,
"If set, allows user to register a SEGV handler even if the tool "
"registers one.")
COMMON_FLAG(bool, use_sigaltstack, true,
More information about the llvm-commits
mailing list