summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-01-10 20:27:48 +0000
committerMatt Morehouse <mascasa@google.com>2018-01-10 20:27:48 +0000
commitf113deaa3cf3d7d5ef2a06e96c372aeb9b748187 (patch)
tree61f83a591134bf6b917459fdfb16d18cfb406f3d /compiler-rt
parent5b6019879580a02fdedca551f405ffd1e792e2d2 (diff)
downloadbcm5719-llvm-f113deaa3cf3d7d5ef2a06e96c372aeb9b748187.tar.gz
bcm5719-llvm-f113deaa3cf3d7d5ef2a06e96c372aeb9b748187.zip
[MSan] Enable use-after-dtor instrumentation by default.
Summary: Enable the compile-time flag -fsanitize-memory-use-after-dtor by default. Note that the run-time option MSAN_OPTIONS=poison_in_dtor=1 still needs to be enabled for destructors to be poisoned. Reviewers: eugenis, vitalybuka, kcc Reviewed By: eugenis, vitalybuka Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D37860 llvm-svn: 322221
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/test/msan/dtor-member.cc2
-rw-r--r--compiler-rt/test/msan/use-after-dtor.cc19
2 files changed, 13 insertions, 8 deletions
diff --git a/compiler-rt/test/msan/dtor-member.cc b/compiler-rt/test/msan/dtor-member.cc
index 13a059947bc..bf20221a363 100644
--- a/compiler-rt/test/msan/dtor-member.cc
+++ b/compiler-rt/test/msan/dtor-member.cc
@@ -7,7 +7,7 @@
// RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan %s -fsanitize=memory -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1
+// RUN: %clangxx_msan %s -fsanitize=memory -fno-sanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK-NO-FLAG < %t.out
// RUN: %clangxx_msan -fsanitize=memory -fsanitize-memory-use-after-dtor %s -o %t && MSAN_OPTIONS=poison_in_dtor=0 %run %t >%t.out 2>&1
diff --git a/compiler-rt/test/msan/use-after-dtor.cc b/compiler-rt/test/msan/use-after-dtor.cc
index 6c751a14f37..45f4dcd69b7 100644
--- a/compiler-rt/test/msan/use-after-dtor.cc
+++ b/compiler-rt/test/msan/use-after-dtor.cc
@@ -1,14 +1,17 @@
// RUN: %clangxx_msan %s -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 not %run %t >%t.out 2>&1
-// RUN: FileCheck %s < %t.out
+// RUN: FileCheck %s --check-prefix=CHECK-UAD < %t.out
// RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 not %run %t >%t.out 2>&1
-// RUN: FileCheck %s < %t.out
+// RUN: FileCheck %s --check-prefix=CHECK-UAD < %t.out
// RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 not %run %t >%t.out 2>&1
-// RUN: FileCheck %s < %t.out
+// RUN: FileCheck %s --check-prefix=CHECK-UAD < %t.out
// RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -fsanitize-memory-track-origins -o %t && MSAN_OPTIONS=poison_in_dtor=1 not %run %t >%t.out 2>&1
-// RUN: FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: FileCheck %s --check-prefixes=CHECK-UAD,CHECK-ORIGINS < %t.out
+
+// RUN: %clangxx_msan %s -fno-sanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 not %run %t > %t.out 2>&1
+// RUN: FileCheck %s --check-prefix=CHECK-UAD-OFF < %t.out
#include <sanitizer/msan_interface.h>
#include <assert.h>
@@ -32,14 +35,16 @@ int main() {
Simple *s = new(&buf) Simple();
s->~Simple();
+ fprintf(stderr, "\n"); // Need output to parse for CHECK-UAD-OFF case
return s->x_;
- // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
- // CHECK: {{#0 0x.* in main.*use-after-dtor.cc:}}[[@LINE-3]]
+ // CHECK-UAD: WARNING: MemorySanitizer: use-of-uninitialized-value
+ // CHECK-UAD: {{#0 0x.* in main.*use-after-dtor.cc:}}[[@LINE-3]]
// CHECK-ORIGINS: Memory was marked as uninitialized
// CHECK-ORIGINS: {{#0 0x.* in __sanitizer_dtor_callback}}
// CHECK-ORIGINS: {{#1 0x.* in Simple::~Simple}}
- // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*main}}
+ // CHECK-UAD: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*main}}
+ // CHECK-UAD-OFF-NOT: SUMMARY: MemorySanitizer: use-of-uninitialized-value
}
OpenPOWER on IntegriCloud