[compiler-rt] r211878 - [msan] Fix truncated stack trace in chained origin reports.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Fri Jun 27 00:32:09 PDT 2014
Author: eugenis
Date: Fri Jun 27 02:32:08 2014
New Revision: 211878
URL: http://llvm.org/viewvc/llvm-project?rev=211878&view=rev
Log:
[msan] Fix truncated stack trace in chained origin reports.
This is a leftover from the times when the next (chained) origin id
was stored as the last frame of a stack trace.
Added:
compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc (with props)
Modified:
compiler-rt/trunk/lib/msan/msan_report.cc
Modified: compiler-rt/trunk/lib/msan/msan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_report.cc?rev=211878&r1=211877&r2=211878&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_report.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_report.cc Fri Jun 27 02:32:08 2014
@@ -90,7 +90,7 @@ static void DescribeOrigin(u32 id) {
// FIXME: copied? modified? passed through? observed?
Printf(" %sUninitialized value was stored to memory at%s\n", d.Origin(),
d.End());
- StackTrace::PrintStack(trace, size - 1);
+ StackTrace::PrintStack(trace, size);
id = prev_id;
}
}
Added: compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc?rev=211878&view=auto
==============================================================================
--- compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc (added)
+++ compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc Fri Jun 27 02:32:08 2014
@@ -0,0 +1,33 @@
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: MSAN_OPTIONS=malloc_context_size=1 not %run %t 2>&1 | FileCheck %s
+
+// Test that stack trace for the intermediate store is not empty.
+
+// CHECK: MemorySanitizer: use-of-uninitialized-value
+// CHECK: #0 {{.*}} in main
+
+// CHECK: Uninitialized value was stored to memory at
+// CHECK: #0 {{.*}} in fn_g
+
+// CHECK: Uninitialized value was created by an allocation of 'z' in the stack frame of function 'main'
+// CHECK: #0 {{.*}} in main
+
+#include <stdio.h>
+
+volatile int x;
+
+__attribute__((noinline))
+void fn_g(int a) {
+ x = a;
+}
+
+__attribute__((noinline))
+void fn_f(int a) {
+ fn_g(a);
+}
+
+int main(int argc, char *argv[]) {
+ int volatile z;
+ fn_f(z);
+ return x;
+}
Propchange: compiler-rt/trunk/test/msan/chained_origin_empty_stack.cc
------------------------------------------------------------------------------
svn:eol-style = LF
More information about the llvm-commits
mailing list