[compiler-rt] b720a59 - [hwasan] provide a runtime flag for printing remaining threads in error report as an extra information
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 19 04:28:44 PDT 2023
Author: Enna1
Date: 2023-04-19T19:28:16+08:00
New Revision: b720a59c119d2e1be23d315432d839066092924b
URL: https://github.com/llvm/llvm-project/commit/b720a59c119d2e1be23d315432d839066092924b
DIFF: https://github.com/llvm/llvm-project/commit/b720a59c119d2e1be23d315432d839066092924b.diff
LOG: [hwasan] provide a runtime flag for printing remaining threads in error report as an extra information
This patch adds a runtime flag `print_live_threads_info`, which defaults to true, controls whether or not prints remaining threads in error report as an extra information.
We(ByteDance) are in the process of enabling hwasan for our server-side applications on AArch64/Linux, these server-side applications have thousands of threads, so it is nice to have this option.
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D148513
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_flags.inc
compiler-rt/lib/hwasan/hwasan_report.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_flags.inc b/compiler-rt/lib/hwasan/hwasan_flags.inc
index 4a226ee2ab8ac..978fa46b705cb 100644
--- a/compiler-rt/lib/hwasan/hwasan_flags.inc
+++ b/compiler-rt/lib/hwasan/hwasan_flags.inc
@@ -23,6 +23,9 @@ HWASAN_FLAG(bool, tag_in_free, true, "")
HWASAN_FLAG(bool, print_stats, false, "")
HWASAN_FLAG(bool, halt_on_error, true, "")
HWASAN_FLAG(bool, atexit, false, "")
+HWASAN_FLAG(
+ bool, print_live_threads_info, true,
+ "If set, prints the remaining threads in report as an extra information.")
// Test only flag to disable malloc/realloc/free memory tagging on startup.
// Tagging can be reenabled with __hwasan_enable_allocator_tagging().
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index e720cb467a051..8f9dc6cf13e04 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -501,7 +501,8 @@ void PrintAddressDescription(
}
// Print the remaining threads, as an extra information, 1 line per thread.
- hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+ if (flags()->print_live_threads_info)
+ hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
if (!num_descriptions_printed)
// We exhausted our possibilities. Bail out.
More information about the llvm-commits
mailing list