[compiler-rt] 1ee2905 - [HWASan] link to doc in reports on Android

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 16:29:57 PST 2023


Author: Florian Mayer
Date: 2023-01-17T16:29:51-08:00
New Revision: 1ee2905764c90a001d8b2d41dc672a7720dcdbec

URL: https://github.com/llvm/llvm-project/commit/1ee2905764c90a001d8b2d41dc672a7720dcdbec
DIFF: https://github.com/llvm/llvm-project/commit/1ee2905764c90a001d8b2d41dc672a7720dcdbec.diff

LOG: [HWASan] link to doc in reports on Android

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D141973

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index de082150b7056..31e190a8ebbcf 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -102,6 +102,15 @@ static StackTrace GetStackTraceFromId(u32 id) {
   return res;
 }
 
+static void MaybePrintAndroidHelpUrl() {
+#if SANITIZER_ANDROID
+  Printf(
+      "Learn more about HWASan reports: "
+      "https://source.android.com/docs/security/test/memory-safety/"
+      "hwasan-reports\n");
+#endif
+}
+
 // A RAII object that holds a copy of the current thread stack ring buffer.
 // The actual stack buffer may change while we are iterating over it (for
 // example, Printf may call syslog() which can itself be built with hwasan).
@@ -600,6 +609,7 @@ void ReportInvalidFree(StackTrace *stack, uptr tagged_addr) {
   if (tag_ptr)
     PrintTagsAroundAddr(tag_ptr);
 
+  MaybePrintAndroidHelpUrl();
   ReportErrorSummary(bug_type, stack);
 }
 
@@ -673,6 +683,7 @@ void ReportTailOverwritten(StackTrace *stack, uptr tagged_addr, uptr orig_size,
   tag_t *tag_ptr = reinterpret_cast<tag_t*>(MemToShadow(untagged_addr));
   PrintTagsAroundAddr(tag_ptr);
 
+  MaybePrintAndroidHelpUrl();
   ReportErrorSummary(bug_type, stack);
 }
 
@@ -742,6 +753,7 @@ void ReportTagMismatch(StackTrace *stack, uptr tagged_addr, uptr access_size,
   if (registers_frame)
     ReportRegisters(registers_frame, pc);
 
+  MaybePrintAndroidHelpUrl();
   ReportErrorSummary(bug_type, stack);
 }
 


        


More information about the llvm-commits mailing list