[compiler-rt] [test][hwasan] Test function name in summaries #77391 (PR #77397)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 17:08:32 PST 2024


https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/77397

>From 9c7ed1b29c6d5d560cf524f2fdb7bc4ba39e7dc8 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Mon, 8 Jan 2024 16:25:29 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Linux/aligned_alloc-alignment.cpp  |  2 +-
 .../hwasan/TestCases/Linux/pvalloc-overflow.cpp  |  2 +-
 .../TestCases/Posix/posix_memalign-alignment.cpp |  2 +-
 .../hwasan/TestCases/allocator_returns_null.cpp  | 16 ++++++++--------
 .../test/hwasan/TestCases/halt-on-error.cpp      |  6 +++---
 .../test/hwasan/TestCases/report-unmapped.cpp    |  2 +-
 .../test/hwasan/TestCases/use-after-free.c       |  2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/compiler-rt/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cpp b/compiler-rt/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cpp
index 429760ba0e1951..ad5b7616e8a7fb 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/aligned_alloc-alignment.cpp
@@ -14,7 +14,7 @@ int main() {
   // CHECK: ERROR: HWAddressSanitizer: invalid alignment requested in aligned_alloc: 17
   // CHECK: {{#0 0x.* in .*}}{{aligned_alloc|memalign}}
   // CHECK: {{#1 0x.* in main .*aligned_alloc-alignment.cpp:}}[[@LINE-3]]
-  // CHECK: SUMMARY: HWAddressSanitizer: invalid-aligned-alloc-alignment
+  // CHECK: SUMMARY: HWAddressSanitizer: invalid-aligned-alloc-alignment {{.*}} in aligned_alloc
 
   printf("pointer after failed aligned_alloc: %zd\n", (size_t)p);
   // CHECK-NULL: pointer after failed aligned_alloc: 0
diff --git a/compiler-rt/test/hwasan/TestCases/Linux/pvalloc-overflow.cpp b/compiler-rt/test/hwasan/TestCases/Linux/pvalloc-overflow.cpp
index b0b1ed3b798cba..bd9f34a0dac921 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/pvalloc-overflow.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/pvalloc-overflow.cpp
@@ -39,6 +39,6 @@ int main(int argc, char *argv[]) {
 // CHECK: {{ERROR: HWAddressSanitizer: pvalloc parameters overflow: size .* rounded up to system page size .* cannot be represented in type size_t}}
 // CHECK: {{#0 0x.* in .*pvalloc}}
 // CHECK: {{#1 0x.* in main .*pvalloc-overflow.cpp:}}
-// CHECK: SUMMARY: HWAddressSanitizer: pvalloc-overflow
+// CHECK: SUMMARY: HWAddressSanitizer: pvalloc-overflow {{.*}} in pvalloc
 
 // CHECK-NULL: errno: 12
diff --git a/compiler-rt/test/hwasan/TestCases/Posix/posix_memalign-alignment.cpp b/compiler-rt/test/hwasan/TestCases/Posix/posix_memalign-alignment.cpp
index eb9355f6da7219..029e086f99ada2 100644
--- a/compiler-rt/test/hwasan/TestCases/Posix/posix_memalign-alignment.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Posix/posix_memalign-alignment.cpp
@@ -11,7 +11,7 @@ int main() {
   // CHECK: ERROR: HWAddressSanitizer: invalid alignment requested in posix_memalign: 17
   // CHECK: {{#0 0x.* in .*posix_memalign}}
   // CHECK: {{#1 0x.* in main .*posix_memalign-alignment.cpp:}}[[@LINE-3]]
-  // CHECK: SUMMARY: HWAddressSanitizer: invalid-posix-memalign-alignment
+  // CHECK: SUMMARY: HWAddressSanitizer: invalid-posix-memalign-alignment {{.*}} in posix_memalign
 
   printf("pointer after failed posix_memalign: %zd\n", (size_t)p);
   // CHECK-NULL: pointer after failed posix_memalign: 42
diff --git a/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp b/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
index aa98076bf91ee9..18ee9406d146fb 100644
--- a/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
+++ b/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
@@ -87,21 +87,21 @@ int main(int argc, char **argv) {
 }
 
 // CHECK-mCRASH: malloc:
-// CHECK-mCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-mCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in malloc
 // CHECK-cCRASH: calloc:
-// CHECK-cCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-cCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in calloc
 // CHECK-coCRASH: calloc-overflow:
-// CHECK-coCRASH: SUMMARY: HWAddressSanitizer: calloc-overflow
+// CHECK-coCRASH: SUMMARY: HWAddressSanitizer: calloc-overflow {{.*}} in calloc
 // CHECK-rCRASH: realloc:
-// CHECK-rCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-rCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in realloc
 // CHECK-mrCRASH: realloc-after-malloc:
-// CHECK-mrCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-mrCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in realloc
 // CHECK-nCRASH: new:
-// CHECK-nCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-nCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in operator new
 // CHECK-nCRASH-OOM: new:
-// CHECK-nCRASH-OOM: SUMMARY: HWAddressSanitizer: out-of-memory
+// CHECK-nCRASH-OOM: SUMMARY: HWAddressSanitizer: out-of-memory {{.*}} in operator new
 // CHECK-nnCRASH: new-nothrow:
-// CHECK-nnCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
+// CHECK-nnCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big {{.*}} in operator new
 
 // CHECK-mNULL: malloc:
 // CHECK-mNULL: errno: 12
diff --git a/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp b/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
index 1a32e4bf4cc4b5..f587ee0fcabd30 100644
--- a/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
+++ b/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
@@ -26,15 +26,15 @@ int main() {
   // COMMON: READ of size 4 at
   // When instrumenting with callbacks, main is actually #1, and #0 is __hwasan_load4.
   // COMMON: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-3]]
-  // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
+  // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
 
   // RECOVER: READ of size 1 at
   // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-7]]
-  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
+  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
 
   // RECOVER: READ of size 1 at
   // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-11]]
-  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
+  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
 
   // COMMON-NOT: tag-mismatch
 }
diff --git a/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp b/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
index a58e50a78d8750..1802e920f390a2 100644
--- a/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
+++ b/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
@@ -36,4 +36,4 @@ int main(int argc, char **argv) {
 // CHECK: Tags for short granules around
 
 // Check that report is complete.
-// CHECK: SUMMARY: HWAddressSanitizer
+// CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
diff --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c
index b3eed88600726c..e0afb767b05937 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-free.c
+++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c
@@ -38,6 +38,6 @@ int main() {
   // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-24]]
   // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes):
   // CHECK: =>{{.*}}[[MEM_TAG]]
-  // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch
+  // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
   return r;
 }

>From 3c47756bc1d169853930a2ad2a8448b17a52079d Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Mon, 8 Jan 2024 17:08:16 -0800
Subject: [PATCH 2/2] undo

Created using spr 1.3.4
---
 compiler-rt/test/hwasan/TestCases/halt-on-error.cpp   | 6 +++---
 compiler-rt/test/hwasan/TestCases/report-unmapped.cpp | 2 +-
 compiler-rt/test/hwasan/TestCases/use-after-free.c    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp b/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
index f587ee0fcabd30..1a32e4bf4cc4b5 100644
--- a/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
+++ b/compiler-rt/test/hwasan/TestCases/halt-on-error.cpp
@@ -26,15 +26,15 @@ int main() {
   // COMMON: READ of size 4 at
   // When instrumenting with callbacks, main is actually #1, and #0 is __hwasan_load4.
   // COMMON: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-3]]
-  // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
+  // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
 
   // RECOVER: READ of size 1 at
   // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-7]]
-  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
+  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
 
   // RECOVER: READ of size 1 at
   // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:[[@LINE-11]]
-  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
+  // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
 
   // COMMON-NOT: tag-mismatch
 }
diff --git a/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp b/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
index 1802e920f390a2..a58e50a78d8750 100644
--- a/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
+++ b/compiler-rt/test/hwasan/TestCases/report-unmapped.cpp
@@ -36,4 +36,4 @@ int main(int argc, char **argv) {
 // CHECK: Tags for short granules around
 
 // Check that report is complete.
-// CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
+// CHECK: SUMMARY: HWAddressSanitizer
diff --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c
index e0afb767b05937..b3eed88600726c 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-free.c
+++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c
@@ -38,6 +38,6 @@ int main() {
   // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-24]]
   // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes):
   // CHECK: =>{{.*}}[[MEM_TAG]]
-  // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in SigTrap
+  // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch
   return r;
 }



More information about the llvm-commits mailing list