[compiler-rt] 404bc5c - [Asan] Loose call stack CHECK conditions

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 18:00:34 PDT 2023


Author: Hau Hsu
Date: 2023-07-27T18:00:21-07:00
New Revision: 404bc5ca2ae5fffa45d5240dcf52b7f134988867

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

LOG: [Asan] Loose call stack CHECK conditions

These test cases are checking specific functions in call stacks.
But if the call stack order is changed (e.g. another function is not inlined),
the frame number would be different.
This patch loose the frame number checks for those conditions.

Depends on D139827

Reviewed By: vitalybuka

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

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Linux/syscalls.cpp
    compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp
    compiler-rt/test/asan/TestCases/memcmp_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp b/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp
index ec14bca76129db..b4cb1a08dcfa18 100644
--- a/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp
@@ -17,6 +17,6 @@ int main(int argc, char *argv[]) {
   __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
   // CHECK: AddressSanitizer: stack-buffer-{{.*}}erflow
   // CHECK: READ of size {{.*}} at {{.*}} thread T0
-  // CHECK: #0 {{.*}} in __sanitizer_syscall{{.*}}recvmsg
+  // CHECK: {{#[0-9]+ .*}} in __sanitizer_syscall{{.*}}recvmsg
   return 0;
 }

diff  --git a/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp b/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp
index 44aa9cd24f6ccc..09994bb8495f24 100644
--- a/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp
@@ -12,7 +12,7 @@ int main(int argc, char **argv) {
   char a2[] = {1, static_cast<char>(2 * argc), 3, 4};
   int res = bcmp(a1, a2, 4 + argc); // BOOM
   // CHECK: AddressSanitizer: stack-buffer-overflow
-  // CHECK: {{#1.*bcmp}}
-  // CHECK: {{#2.*main}}
+  // CHECK: {{#[0-9]+ .*bcmp}}
+  // CHECK: {{#[0-9]+ .*main}}
   return res;
 }

diff  --git a/compiler-rt/test/asan/TestCases/memcmp_test.cpp b/compiler-rt/test/asan/TestCases/memcmp_test.cpp
index e666b6d162b9ee..dcabb8276f6695 100644
--- a/compiler-rt/test/asan/TestCases/memcmp_test.cpp
+++ b/compiler-rt/test/asan/TestCases/memcmp_test.cpp
@@ -11,7 +11,7 @@ int main(int argc, char **argv) {
   char a2[] = {1, static_cast<char>(2*argc), 3, 4};
   int res = memcmp(a1, a2, 4 + argc);  // BOOM
   // CHECK: AddressSanitizer: stack-buffer-overflow
-  // CHECK: {{#1.*memcmp}}
-  // CHECK: {{#2.*main}}
+  // CHECK: {{#[0-9]+ .*memcmp}}
+  // CHECK: {{#[0-9]+ .*main}}
   return res;
 }


        


More information about the llvm-commits mailing list