Skip to content

[compiler-rt] [UBSan] leave BufferedStackTrace uninit #102253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

fmayer
Copy link
Contributor

@fmayer fmayer commented Aug 6, 2024

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

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Aug 6, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Florian Mayer (fmayer)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/102253.diff

2 Files Affected:

  • (modified) compiler-rt/lib/ubsan/ubsan_diag.cpp (+1-1)
  • (modified) compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp (+1-1)
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index 1625dfe89eb11..2146ed3c27287 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 5526ae0516504..03dfde8908dd9 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();
 }

Created using spr 1.3.4
@fmayer fmayer changed the base branch from users/fmayer/spr/main.compiler-rt-ubsan-leave-bufferedstacktrace-uninit to main August 7, 2024 17:10
@fmayer fmayer changed the base branch from main to users/fmayer/spr/main.compiler-rt-ubsan-leave-bufferedstacktrace-uninit August 7, 2024 20:56
Created using spr 1.3.4
@fmayer fmayer requested a review from vitalybuka August 7, 2024 22:14
fmayer added a commit that referenced this pull request Aug 7, 2024
Otherwise we have to memset 2040 bytes (255 * 8) for each call

Pull Request: #102253
@fmayer fmayer closed this Aug 7, 2024
mizvekov added a commit to mizvekov/llvm-project that referenced this pull request Aug 8, 2024
…guments (llvm#101782)"

This reverts commit 7483711.

Reverted due to both regression reported on PR and llvm#102253
mizvekov added a commit to mizvekov/llvm-project that referenced this pull request Aug 8, 2024
…guments (llvm#101782)"

This reverts commit 7483711.

Reverted due to both regression reported on PR and llvm#102253
fmayer added a commit to fmayer/llvm-project that referenced this pull request Sep 13, 2024
Otherwise we have to memset 2040 bytes (255 * 8) for each call

Pull Request: llvm#102253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants