[hwasan] report heap-buffer-overflow location, once, not once per each live thread
@@ -61,10 +61,9 @@ bool FindHeapAllocation(HeapAllocationsRingBuffer *rb,
}
void PrintAddressDescription(uptr tagged_addr, uptr access_size) {
+ Decorator d;
int num_descriptions_printed = 0;
uptr untagged_addr = UntagAddr(tagged_addr);
- Thread::VisitAllLiveThreads([&](Thread *t) {
- Decorator d;
// Check if this looks like a heap buffer overflow by scanning
// the shadow left and right and looking for the first adjacent
// object with a different memory tag. If that tag matches addr_tag,
@@ -99,7 +98,7 @@ void PrintAddressDescription(uptr tagged_addr, uptr access_size) {
candidate == right ? "left" : "right", chunk.UsedSize(),
chunk.Beg(), chunk.End());
Printf("%s", d.Allocation());
- Printf("allocated here:\n", t);
+ Printf("allocated here:\n");
Printf("%s", d.Default());
GetStackTraceFromId(chunk.GetAllocStackId()).Print();
num_descriptions_printed++;
@@ -107,6 +106,7 @@ void PrintAddressDescription(uptr tagged_addr, uptr access_size) {
}
}
+ Thread::VisitAllLiveThreads([&](Thread *t) {
// Scan all threads' ring buffers to find if it's a heap-use-after-free.
HeapAllocationRecord har;
if (FindHeapAllocation(t->heap_allocations(), tagged_addr, &har)) {
