Skip to content

[NFC] [sanitizers] leave BufferedStackTrace uninit in tests #102251

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

This is for consistency with the production code

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

This is for consistency with the production code


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

2 Files Affected:

  • (modified) compiler-rt/lib/asan/tests/asan_noinst_test.cpp (+4-4)
  • (modified) compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp (+1-1)
diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
index df7de2d7d15ed..ba1eab1a90f44 100644
--- a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
@@ -137,7 +137,7 @@ TEST(AddressSanitizer, DISABLED_InternalPrintShadow) {
 }
 
 TEST(AddressSanitizer, QuarantineTest) {
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 
@@ -159,7 +159,7 @@ TEST(AddressSanitizer, QuarantineTest) {
 void *ThreadedQuarantineTestWorker(void *unused) {
   (void)unused;
   u32 seed = my_rand();
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 
@@ -194,7 +194,7 @@ TEST(AddressSanitizer, ThreadedQuarantineTest) {
 
 void *ThreadedOneSizeMallocStress(void *unused) {
   (void)unused;
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
   const size_t kNumMallocs = 1000;
@@ -238,7 +238,7 @@ static void TestLoadStoreCallbacks(CB cb[2][5]) {
   uptr buggy_ptr;
 
   __asan_test_only_reported_buggy_pointer = &buggy_ptr;
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
index 11ca1fd7f0517..cf42294a4b0c3 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
@@ -259,7 +259,7 @@ TEST_F(StackPrintDeathTest, SKIP_ON_SPARC(RequiresNonNullBuffer)) {
 #endif // SANITIZER_CAN_FAST_UNWIND
 
 TEST(SlowUnwindTest, ShortStackTrace) {
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   uptr pc = StackTrace::GetCurrentPc();
   uptr bp = GET_CURRENT_FRAME();
   stack.Unwind(pc, bp, nullptr, false, /*max_depth=*/0);

Created using spr 1.3.4
@fmayer fmayer changed the base branch from users/fmayer/spr/main.nfc-sanitizers-leave-bufferedstacktrace-uninit-in-tests to main August 7, 2024 17:09
@fmayer fmayer changed the base branch from main to users/fmayer/spr/main.nfc-sanitizers-leave-bufferedstacktrace-uninit-in-tests August 7, 2024 20:55
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
This is for consistency with the production code

Pull Request: #102251
@fmayer fmayer closed this Aug 7, 2024
fmayer added a commit to fmayer/llvm-project that referenced this pull request Sep 13, 2024
This is for consistency with the production code

Pull Request: llvm#102251
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