[compiler-rt] r216657 - [UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin

Alexander Potapenko glider at google.com
Thu Aug 28 02:25:11 PDT 2014


Author: glider
Date: Thu Aug 28 04:25:06 2014
New Revision: 216657

URL: http://llvm.org/viewvc/llvm-project?rev=216657&view=rev
Log:
[UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin
to make the tests green.
Slow stack unwinding is disabled in libsanitizer on Darwin now.

Modified:
    compiler-rt/trunk/test/asan/lit.cfg
    compiler-rt/trunk/test/lit.common.cfg
    compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp
    compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=216657&r1=216656&r2=216657&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Thu Aug 28 04:25:06 2014
@@ -113,8 +113,6 @@ if config.host_arch.find('64') != -1 and
 else:
   kernel_bits = '32'
 
-# Define CHECK-%os to check for OS-dependent output.
-config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
 config.substitutions.append( ('CHECK-%kernel_bits', ("CHECK-kernel-" + kernel_bits + "-bits")))
 
 config.available_features.add("asan-" + config.bits + "-bits")

Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=216657&r1=216656&r2=216657&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Thu Aug 28 04:25:06 2014
@@ -69,6 +69,9 @@ config.substitutions.append(
 # Allow tests to be executed on a simulator or remotely.
 config.substitutions.append( ('%run', config.emulator) )
 
+# Define CHECK-%os to check for OS-dependent output.
+config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
+
 # Add supported compiler_rt architectures to a list of available features.
 compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
 if compiler_rt_arch:

Modified: compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp?rev=216657&r1=216656&r2=216657&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Misc/missing_return.cpp Thu Aug 28 04:25:06 2014
@@ -1,13 +1,18 @@
 // RUN: %clangxx -fsanitize=return -g %s -O3 -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: UBSAN_OPTIONS=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=STACKTRACE
+// RUN: UBSAN_OPTIONS=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os-STACKTRACE
 
 // CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
 int f() {
-// STACKTRACE: #0 {{.*}} in f(){{.*}}missing_return.cpp:[[@LINE-1]]
+// Slow stack unwinding is disabled on Darwin for now, see
+// https://code.google.com/p/address-sanitizer/issues/detail?id=137
+// CHECK-Linux-STACKTRACE: #0 {{.*}} in f(){{.*}}missing_return.cpp:[[@LINE-1]]
+// Check for already checked line to avoid lit error reports.
+// CHECK-Darwin-STACKTRACE: missing_return.cpp
 }
 
 int main(int, char **argv) {
   return f();
-// STACKTRACE: #1 {{.*}} in main{{.*}}missing_return.cpp:[[@LINE-1]]
+// Disabled on Darwin, see above.
+// CHECK-Linux-STACKTRACE: #1 {{.*}} in main{{.*}}missing_return.cpp:[[@LINE-1]]
 }

Modified: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp?rev=216657&r1=216656&r2=216657&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/misaligned.cpp Thu Aug 28 04:25:06 2014
@@ -6,7 +6,7 @@
 // RUN: %run %t m1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
 // RUN: %run %t f1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
 // RUN: %run %t n1 2>&1 | FileCheck %s --check-prefix=CHECK-NEW
-// RUN: UBSAN_OPTIONS=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-STACK-LOAD
+// RUN: UBSAN_OPTIONS=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-%os-STACK-LOAD
 
 #include <new>
 
@@ -32,7 +32,11 @@ int main(int, char **argv) {
     // CHECK-LOAD-NEXT: {{^ 00 00 00 01 02 03 04  05}}
     // CHECK-LOAD-NEXT: {{^             \^}}
     return *p && 0;
-    // CHECK-STACK-LOAD: #0 {{.*}} in main{{.*}}misaligned.cpp
+    // Slow stack unwinding is disabled on Darwin for now, see
+    // https://code.google.com/p/address-sanitizer/issues/detail?id=137
+    // CHECK-Linux-STACK-LOAD: #0 {{.*}} in main{{.*}}misaligned.cpp
+    // Check for the already checked line to avoid lit error reports.
+    // CHECK-Darwin-STACK-LOAD: {{ }}
 
   case 's':
     // CHECK-STORE: misaligned.cpp:[[@LINE+4]]:5: runtime error: store to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment





More information about the llvm-commits mailing list