[compiler-rt] r344174 - [hwasan] print all threads in a bug report

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 11:56:32 PDT 2018


Author: kcc
Date: Wed Oct 10 11:56:31 2018
New Revision: 344174

URL: http://llvm.org/viewvc/llvm-project?rev=344174&view=rev
Log:
[hwasan] print all threads in a bug report

Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_report.cc
    compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c

Modified: compiler-rt/trunk/lib/hwasan/hwasan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_report.cc?rev=344174&r1=344173&r2=344174&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_report.cc (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_report.cc Wed Oct 10 11:56:31 2018
@@ -155,13 +155,13 @@ void PrintAddressDescription(
       Printf("previously allocated here:\n", t);
       Printf("%s", d.Default());
       GetStackTraceFromId(har.alloc_context_id).Print();
-      t->Announce();
 
       // Print a developer note: the index of this heap object
       // in the thread's deallocation ring buffer.
       Printf("hwasan_dev_note_heap_rb_distance: %zd %zd\n", D,
              flags()->heap_history_size);
 
+      t->Announce();
       num_descriptions_printed++;
     }
 
@@ -196,6 +196,9 @@ void PrintAddressDescription(
     }
   });
 
+  // Print the remaining threads, as an extra information, 1 line per thread.
+  hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+
   if (!num_descriptions_printed)
     // We exhausted our possibilities. Bail out.
     Printf("HWAddressSanitizer can not describe address in more detail.\n");

Modified: compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c?rev=344174&r1=344173&r2=344174&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c Wed Oct 10 11:56:31 2018
@@ -36,6 +36,8 @@ void *Use(void *arg) {
   // CHECK: in Allocate
   // CHECK: Thread: T2 0x
   // CHECK: Thread: T3 0x
+  // CHECK-DAG: Thread: T0 0x
+  // CHECK-DAG: Thread: T1 0x
   __sync_fetch_and_add(&state, 1);
   return NULL;
 }




More information about the llvm-commits mailing list