[compiler-rt] aacd1af - [compiler-rt] [UBSan] leave BufferedStackTrace uninit

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 15:19:49 PDT 2024


Author: Florian Mayer
Date: 2024-08-07T15:19:27-07:00
New Revision: aacd1afa1ed2a72464cab8586edadbcd2c6bb47c

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

LOG: [compiler-rt] [UBSan] leave BufferedStackTrace uninit

Otherwise we have to memset 2040 bytes (255 * 8) for each call

Pull Request: https://github.com/llvm/llvm-project/pull/102253

Added: 
    

Modified: 
    compiler-rt/lib/ubsan/ubsan_diag.cpp
    compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index 1625dfe89eb11f..2146ed3c27287e 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -47,7 +47,7 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) {
   if (!flags()->print_stacktrace)
     return;
 
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
                 common_flags()->fast_unwind_on_fatal);
   stack.Print();

diff  --git a/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp b/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp
index 5526ae05165041..03dfde8908dd9e 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp
@@ -29,7 +29,7 @@ extern "C" {
 SANITIZER_INTERFACE_ATTRIBUTE
 void __sanitizer_print_stack_trace() {
   GET_CURRENT_PC_BP;
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal);
   stack.Print();
 }


        


More information about the llvm-commits mailing list