summaryrefslogtreecommitdiff
path: root/lib/msan/msan_report.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-01-22 13:33:16 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-01-22 13:33:16 +0000
commita50b9b2e06f85fef88f27724a16f6f62c5dd229f (patch)
treefdb90d4fb82539e5764d63c3b5f26dec36a0899a /lib/msan/msan_report.cc
parentcafe9a53643f3d813fa0a328a62175e19ff3a1ca (diff)
[msan] Better use-after-free reports.
By attaching an extra integer tag to heap origins, we are able to distinguish between uninits - created by heap allocation, - created by heap deallocation (i.e. use-after-free), - created by __msan_allocated_memory call, - etc. See https://code.google.com/p/memory-sanitizer/issues/detail?id=35. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_report.cc')
-rw-r--r--lib/msan/msan_report.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc
index 6867ee369..33c28b2fb 100644
--- a/lib/msan/msan_report.cc
+++ b/lib/msan/msan_report.cc
@@ -75,8 +75,23 @@ static void DescribeOrigin(u32 id) {
DescribeStackOrigin(so, pc);
} else {
StackTrace stack = o.getStackTraceForHeapOrigin();
- Printf(" %sUninitialized value was created by a heap allocation%s\n",
- d.Origin(), d.End());
+ switch (stack.tag) {
+ case StackTrace::TAG_ALLOC:
+ Printf(" %sUninitialized value was created by a heap allocation%s\n",
+ d.Origin(), d.End());
+ break;
+ case StackTrace::TAG_DEALLOC:
+ Printf(" %sUninitialized value was created by a heap deallocation%s\n",
+ d.Origin(), d.End());
+ break;
+ case STACK_TRACE_TAG_POISON:
+ Printf(" %sMemory was marked as uninitialized%s\n", d.Origin(),
+ d.End());
+ break;
+ default:
+ Printf(" %sUninitialized value was created%s\n", d.Origin(), d.End());
+ break;
+ }
stack.Print();
}
}