[compiler-rt] r244210 - Revert "[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski"

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 05:42:46 PDT 2015


Author: rengolin
Date: Thu Aug  6 07:42:46 2015
New Revision: 244210

URL: http://llvm.org/viewvc/llvm-project?rev=244210&view=rev
Log:
Revert "[sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski"

This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline.

Removed:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc
Modified:
    compiler-rt/trunk/lib/asan/asan_internal.h
    compiler-rt/trunk/lib/asan/asan_posix.cc
    compiler-rt/trunk/lib/asan/asan_report.cc
    compiler-rt/trunk/lib/asan/asan_report.h
    compiler-rt/trunk/lib/asan/asan_rtl.cc
    compiler-rt/trunk/lib/asan/asan_win.cc
    compiler-rt/trunk/lib/asan/tests/asan_test.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc

Modified: compiler-rt/trunk/lib/asan/asan_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_internal.h?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_internal.h Thu Aug  6 07:42:46 2015
@@ -75,7 +75,7 @@ void *AsanDoesNotSupportStaticLinkage();
 void AsanCheckDynamicRTPrereqs();
 void AsanCheckIncompatibleRT();
 
-void AsanOnDeadlySignal(int, void *siginfo, void *context);
+void AsanOnSIGSEGV(int, void *siginfo, void *context);
 
 void DisableReexec();
 void MaybeReexec();

Modified: compiler-rt/trunk/lib/asan/asan_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_posix.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_posix.cc Thu Aug  6 07:42:46 2015
@@ -33,11 +33,11 @@
 
 namespace __asan {
 
-void AsanOnDeadlySignal(int signo, void *siginfo, void *context) {
+void AsanOnSIGSEGV(int, void *siginfo, void *context) {
   ScopedDeadlySignal signal_scope(GetCurrentThread());
   int code = (int)((siginfo_t*)siginfo)->si_code;
   // Write the first message using the bullet-proof write.
-  if (18 != internal_write(2, "ASAN:DEADLYSIGNAL\n", 18)) Die();
+  if (13 != internal_write(2, "ASAN:SIGSEGV\n", 13)) Die();
   SignalContext sig = SignalContext::Create(siginfo, context);
 
   // Access at a reasonable offset above SP, or slightly below it (to account
@@ -75,10 +75,8 @@ void AsanOnDeadlySignal(int signo, void
   // unaligned memory access.
   if (IsStackAccess && (code == si_SEGV_MAPERR || code == si_SEGV_ACCERR))
     ReportStackOverflow(sig);
-  else if (signo == SIGFPE)
-    ReportDeadlySignal("FPE", sig);
   else
-    ReportDeadlySignal("SEGV", sig);
+    ReportSIGSEGV("SEGV", sig);
 }
 
 // ---------------------- TSD ---------------- {{{1

Modified: compiler-rt/trunk/lib/asan/asan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_report.cc Thu Aug  6 07:42:46 2015
@@ -686,7 +686,7 @@ void ReportStackOverflow(const SignalCon
   ReportErrorSummary("stack-overflow", &stack);
 }
 
-void ReportDeadlySignal(const char *description, const SignalContext &sig) {
+void ReportSIGSEGV(const char *description, const SignalContext &sig) {
   ScopedInErrorReport in_report;
   Decorator d;
   Printf("%s", d.Warning());
@@ -703,7 +703,7 @@ void ReportDeadlySignal(const char *desc
   stack.Print();
   MaybeDumpInstructionBytes(sig.pc);
   Printf("AddressSanitizer can not provide additional info.\n");
-  ReportErrorSummary(description, &stack);
+  ReportErrorSummary("SEGV", &stack);
 }
 
 void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack) {

Modified: compiler-rt/trunk/lib/asan/asan_report.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.h?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.h (original)
+++ compiler-rt/trunk/lib/asan/asan_report.h Thu Aug  6 07:42:46 2015
@@ -50,8 +50,7 @@ void DescribeThread(AsanThreadContext *c
 
 // Different kinds of error reports.
 void NORETURN ReportStackOverflow(const SignalContext &sig);
-void NORETURN ReportDeadlySignal(const char* description,
-                                 const SignalContext &sig);
+void NORETURN ReportSIGSEGV(const char *description, const SignalContext &sig);
 void NORETURN ReportNewDeleteSizeMismatch(uptr addr, uptr delete_size,
                                           BufferedStackTrace *free_stack);
 void NORETURN ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack);

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Thu Aug  6 07:42:46 2015
@@ -457,7 +457,7 @@ static void AsanInitInternal() {
   }
 
   AsanTSDInit(PlatformTSDDtor);
-  InstallDeadlySignalHandlers(AsanOnDeadlySignal);
+  InstallDeadlySignalHandlers(AsanOnSIGSEGV);
 
   AllocatorOptions allocator_options;
   allocator_options.SetFrom(flags(), common_flags());

Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Thu Aug  6 07:42:46 2015
@@ -197,7 +197,7 @@ void ReadContextStack(void *context, upt
   UNIMPLEMENTED();
 }
 
-void AsanOnDeadlySignal(int, void *siginfo, void *context) {
+void AsanOnSIGSEGV(int, void *siginfo, void *context) {
   UNIMPLEMENTED();
 }
 
@@ -214,7 +214,7 @@ static long WINAPI SEHHandler(EXCEPTION_
             ? "access-violation"
             : "in-page-error";
     SignalContext sig = SignalContext::Create(exception_record, context);
-    ReportDeadlySignal(description, sig);
+    ReportSIGSEGV(description, sig);
   }
 
   // FIXME: Handle EXCEPTION_STACK_OVERFLOW here.

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=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Thu Aug  6 07:42:46 2015
@@ -250,24 +250,12 @@ TEST(AddressSanitizer, BitFieldNegativeT
 #if ASAN_NEEDS_SEGV
 namespace {
 
-const char kSEGVCrash[] = "AddressSanitizer: SEGV on unknown address";
-const char kFPECrash[] = "AddressSanitizer: FPE on unknown address";
+const char kUnknownCrash[] = "AddressSanitizer: SEGV on unknown address";
 const char kOverriddenHandler[] = "ASan signal handler has been overridden\n";
 
 TEST(AddressSanitizer, WildAddressTest) {
   char *c = (char*)0x123;
-  EXPECT_DEATH(*c = 0, kSEGVCrash);
-}
-
-void division_by_zero() {
-  volatile int one = 1;
-  volatile int zero = 0;
-  volatile int sink;
-  sink = one / zero;
-}
-
-TEST(AddressSanitizer, FPECrashTest) {
-  EXPECT_DEATH(division_by_zero(), kFPECrash);
+  EXPECT_DEATH(*c = 0, kUnknownCrash);
 }
 
 void my_sigaction_sighandler(int, siginfo_t*, void*) {
@@ -291,10 +279,10 @@ TEST(AddressSanitizer, SignalTest) {
   EXPECT_EQ(0, sigaction(SIGBUS, &sigact, 0));
 #endif
   char *c = (char*)0x123;
-  EXPECT_DEATH(*c = 0, kSEGVCrash);
+  EXPECT_DEATH(*c = 0, kUnknownCrash);
   // ... and signal().
   EXPECT_EQ(0, signal(SIGSEGV, my_signal_sighandler));
-  EXPECT_DEATH(*c = 0, kSEGVCrash);
+  EXPECT_DEATH(*c = 0, kUnknownCrash);
 }
 }  // 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=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.inc Thu Aug  6 07:42:46 2015
@@ -78,8 +78,6 @@ COMMON_FLAG(bool, handle_segv, SANITIZER
             "If set, registers the tool's custom SIGSEGV/SIGBUS handler.")
 COMMON_FLAG(bool, handle_abort, false,
             "If set, registers the tool's custom SIGABRT handler.")
-COMMON_FLAG(bool, handle_sigfpe, true,
-            "If set, registers the tool's custom SIGFPE handler.")
 COMMON_FLAG(bool, allow_user_segv_handler, false,
             "If set, allows user to register a SEGV handler even if the tool "
             "registers one.")

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Thu Aug  6 07:42:46 2015
@@ -1034,8 +1034,6 @@ AndroidApiLevel AndroidGetApiLevel() {
 bool IsDeadlySignal(int signum) {
   if (common_flags()->handle_abort && signum == SIGABRT)
     return true;
-  if (common_flags()->handle_sigfpe && signum == SIGFPE)
-    return true;
   return (signum == SIGSEGV || signum == SIGBUS) && common_flags()->handle_segv;
 }
 

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Thu Aug  6 07:42:46 2015
@@ -188,7 +188,6 @@ void InstallDeadlySignalHandlers(SignalH
   MaybeInstallSigaction(SIGSEGV, handler);
   MaybeInstallSigaction(SIGBUS, handler);
   MaybeInstallSigaction(SIGABRT, handler);
-  MaybeInstallSigaction(SIGFPE, handler);
 }
 #endif  // SANITIZER_GO
 

Modified: compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc?rev=244210&r1=244209&r2=244210&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/allow_user_segv.cc Thu Aug  6 07:42:46 2015
@@ -55,5 +55,5 @@ int main() {
 
 // CHECK: User sigaction installed
 // CHECK-NEXT: User sigaction called
-// CHECK-NEXT: ASAN:DEADLYSIGNAL
+// CHECK-NEXT: ASAN:SIGSEGV
 // CHECK: AddressSanitizer: SEGV on unknown address

Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc?rev=244209&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/fpe.cc (removed)
@@ -1,27 +0,0 @@
-// Test the handle_sigfpe option.
-// RUN: %clang %s -o %t
-// RUN:                               not         %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
-// RUN: %tool_options=handle_sigfpe=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
-// RUN: %tool_options=handle_sigfpe=1 not         %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
-// FIXME: implement in other sanitizers, not just asan.
-// XFAIL: msan
-// XFAIL: lsan
-// XFAIL: tsan
-#include <assert.h>
-#include <stdio.h>
-#include <sanitizer/asan_interface.h>
-
-void death() {
-  fprintf(stderr, "DEATH CALLBACK\n");
-}
-
-int main(int argc, char **argv) {
-  __sanitizer_set_death_callback(death);
-  volatile int one = 1;
-  volatile int zero = 0;
-  volatile int sink;
-  sink = one / zero;
-}
-// CHECK1: ERROR: {{.*}}Sanitizer:
-// CHECK1: DEATH CALLBACK
-// CHECK0-NOT: Sanitizer




More information about the llvm-commits mailing list