summaryrefslogtreecommitdiff
path: root/lib/msan/msan_report.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-12-03 13:58:40 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-12-03 13:58:40 +0000
commit434a3e4dee2031afbb10c68a0f944071d131840e (patch)
treee84df970340820eb2d06bf4f60e8f084af0252fa /lib/msan/msan_report.cc
parent948698a1c629005cc27de7ca5497504a2f6159e9 (diff)
[msan] Change the way origin ids are built.
Previously, all origin ids were "chained" origins, i.e values of ChainedOriginDepot. This added a level of indirection for simple stack and heap allocation, which were represented as chains of length 1. This costs both RAM and CPU, but provides a joined 2**29 origin id space. It also made function (any instrumented function) entry non-async-signal-safe, but that does not really matter because memory stores in track-origins=2 mode are not async-signal-safe anyway. With this change, the type of the origin is encoded in origin id. See comment in msan_origin.h for more details. This reduces chained and stack origin id range to 2**28 each, but leaves extra 2**31 for heap origins. This change should not have any user-visible effects. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_report.cc')
-rw-r--r--lib/msan/msan_report.cc45
1 files changed, 17 insertions, 28 deletions
diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc
index f4978c70b..717c4a958 100644
--- a/lib/msan/msan_report.cc
+++ b/lib/msan/msan_report.cc
@@ -61,34 +61,23 @@ static void DescribeStackOrigin(const char *so, uptr pc) {
static void DescribeOrigin(u32 id) {
VPrintf(1, " raw origin id: %d\n", id);
Decorator d;
- while (true) {
- Origin o(id);
- if (!o.isValid()) {
- Printf(" %sinvalid origin id(%d)%s\n", d.Warning(), id, d.End());
- break;
- }
- u32 prev_id;
- u32 stack_id = ChainedOriginDepotGet(o.id(), &prev_id);
- Origin prev_o(prev_id);
-
- if (prev_o.isStackRoot()) {
- uptr pc;
- const char *so = GetStackOriginDescr(stack_id, &pc);
- DescribeStackOrigin(so, pc);
- break;
- } else if (prev_o.isHeapRoot()) {
- Printf(" %sUninitialized value was created by a heap allocation%s\n",
- d.Origin(), d.End());
- StackDepotGet(stack_id).Print();
- break;
- } else {
- // chained origin
- // FIXME: copied? modified? passed through? observed?
- Printf(" %sUninitialized value was stored to memory at%s\n", d.Origin(),
- d.End());
- StackDepotGet(stack_id).Print();
- id = prev_id;
- }
+ Origin o = Origin::FromRawId(id);
+ while (o.isChainedOrigin()) {
+ StackTrace stack;
+ o = o.getNextChainedOrigin(&stack);
+ Printf(" %sUninitialized value was stored to memory at%s\n", d.Origin(),
+ d.End());
+ stack.Print();
+ }
+ if (o.isStackOrigin()) {
+ uptr pc;
+ const char *so = GetStackOriginDescr(o.getStackId(), &pc);
+ DescribeStackOrigin(so, pc);
+ } else {
+ StackTrace stack = o.getStackTraceForHeapOrigin();
+ Printf(" %sUninitialized value was created by a heap allocation%s\n",
+ d.Origin(), d.End());
+ stack.Print();
}
}