[compiler-rt] r226658 - [msan] Update origin for the entire destination range on memory store.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Jan 21 05:21:31 PST 2015


Author: eugenis
Date: Wed Jan 21 07:21:31 2015
New Revision: 226658

URL: http://llvm.org/viewvc/llvm-project?rev=226658&view=rev
Log:
[msan] Update origin for the entire destination range on memory store.

Previously we always stored 4 bytes of origin at the destination address
even for 8-byte (and longer) stores.

This should fix rare missing, or incorrect, origin stacks in MSan reports.

Added:
    compiler-rt/trunk/test/msan/origin-store-long.cc   (with props)

Added: compiler-rt/trunk/test/msan/origin-store-long.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/origin-store-long.cc?rev=226658&view=auto
==============================================================================
--- compiler-rt/trunk/test/msan/origin-store-long.cc (added)
+++ compiler-rt/trunk/test/msan/origin-store-long.cc Wed Jan 21 07:21:31 2015
@@ -0,0 +1,21 @@
+// Check that 8-byte store updates origin for the full store range.
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
+
+#include <sanitizer/msan_interface.h>
+
+int main() {
+  uint64_t *volatile p = new uint64_t;
+  uint64_t *volatile q = new uint64_t;
+  *p = *q;
+  char *z = (char *)p;
+  return z[6];
+// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
+// CHECK:   in main {{.*}}origin-store-long.cc:[[@LINE-2]]
+
+// CHECK:  Uninitialized value was created by a heap allocation
+// CHECK:   in main {{.*}}origin-store-long.cc:[[@LINE-8]]
+}
+

Propchange: compiler-rt/trunk/test/msan/origin-store-long.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list