From d40e582d4ee5c99ced0050dd376541e6dfa7de08 Mon Sep 17 00:00:00 2001 From: ziper Date: Thu, 29 May 2025 06:41:48 +0000 Subject: [PATCH] fix compiler_rt testcases of sanitizer Signed-off-by: ziper --- compiler-rt/lib/scudo/standalone/CMakeLists.txt | 2 +- compiler-rt/test/hwasan/TestCases/double-free.c | 4 ++-- compiler-rt/test/hwasan/TestCases/realloc-after-free.c | 2 +- compiler-rt/test/hwasan/TestCases/tag_in_free.c | 4 ++-- compiler-rt/test/hwasan/TestCases/use-after-free.c | 2 +- compiler-rt/test/tsan/tls_race.cpp | 2 +- compiler-rt/test/tsan/tls_race2.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/CMakeLists.txt index ad4a5e303267..bcd93d69b7c9 100644 --- a/compiler-rt/lib/scudo/standalone/CMakeLists.txt +++ b/compiler-rt/lib/scudo/standalone/CMakeLists.txt @@ -135,7 +135,7 @@ if (COMPILER_RT_HAS_GWP_ASAN) add_dependencies(scudo_standalone gwp_asan) list(APPEND SCUDO_OBJECT_LIBS RTGwpAsan RTGwpAsanBacktraceLibc RTGwpAsanSegvHandler - RTGwpAsanOptionsParser) + RTGwpAsanOptionsParser RTSanitizerCommon RTSanitizerCommonLibc) append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer diff --git a/compiler-rt/test/hwasan/TestCases/double-free.c b/compiler-rt/test/hwasan/TestCases/double-free.c index 6d177fdef702..e16619d6ac00 100644 --- a/compiler-rt/test/hwasan/TestCases/double-free.c +++ b/compiler-rt/test/hwasan/TestCases/double-free.c @@ -11,14 +11,14 @@ int main() { char * volatile x = (char*)malloc(40); free(x); free(x); - // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}} + // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread {{.*}} // CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem) // CHECK: #0 {{[0x]+}}{{.*}}[[PC]] // If we instrument using calls (default on x86), free is not the top frame // of the fault. With TCO the free frame can be replaced with the interceptor. // CHECK: in {{.*}}free // CHECK: freed by thread {{.*}} here: - // CHECK: previously allocated here: + // CHECK: previously allocated by thread {{.*}} here: // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes): // CHECK: =>{{.*}}[[MEM_TAG]] fprintf(stderr, "DONE\n"); diff --git a/compiler-rt/test/hwasan/TestCases/realloc-after-free.c b/compiler-rt/test/hwasan/TestCases/realloc-after-free.c index c4bc48c9ccda..ab0b92d39f69 100644 --- a/compiler-rt/test/hwasan/TestCases/realloc-after-free.c +++ b/compiler-rt/test/hwasan/TestCases/realloc-after-free.c @@ -19,7 +19,7 @@ int main(int argc, char **argv) { // CHECK: ERROR: HWAddressSanitizer: invalid-free on address // CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem) // CHECK: freed by thread {{.*}} here: -// CHECK: previously allocated here: +// CHECK: previously allocated by thread {{.*}} here: // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes): // CHECK: =>{{.*}}[[MEM_TAG]] fprintf(stderr, "DONE\n"); diff --git a/compiler-rt/test/hwasan/TestCases/tag_in_free.c b/compiler-rt/test/hwasan/TestCases/tag_in_free.c index 51e8d015d36e..edf3956cf009 100644 --- a/compiler-rt/test/hwasan/TestCases/tag_in_free.c +++ b/compiler-rt/test/hwasan/TestCases/tag_in_free.c @@ -40,8 +40,8 @@ int main() { #ifdef FREE // FREE: READ of size 1 at // FREE: is located 0 bytes inside of 10-byte region - // FREE: freed by thread T0 here: - // FREE: previously allocated here: + // FREE: freed by thread {{.*}} here: + // FREE: previously allocated by thread {{.*}} here: char volatile y = p[0]; #endif diff --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c index 94a8939162d0..655674f86c0c 100644 --- a/compiler-rt/test/hwasan/TestCases/use-after-free.c +++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c @@ -35,7 +35,7 @@ int main() { // CHECK: #0 {{.*}} in {{.*}}free{{.*}} {{.*}}hwasan_allocation_functions.cpp // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-19]] - // CHECK: previously allocated here: + // CHECK: previously allocated by thread {{.*}} here: // CHECK: #0 {{.*}} in {{.*}}malloc{{.*}} {{.*}}hwasan_allocation_functions.cpp // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-24]] // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes): diff --git a/compiler-rt/test/tsan/tls_race.cpp b/compiler-rt/test/tsan/tls_race.cpp index 0821680d0aae..a8d6143f3878 100644 --- a/compiler-rt/test/tsan/tls_race.cpp +++ b/compiler-rt/test/tsan/tls_race.cpp @@ -25,4 +25,4 @@ int main() { // CHECK-NetBSD: Location is TLS of main thread. // CHECK-Darwin: Location is heap block of size 4 // OHOS_LOCAL -// CHECK-OHOS: Location is heap block of size +// CHECK-OHOS: Location is TLS of main thread. diff --git a/compiler-rt/test/tsan/tls_race2.cpp b/compiler-rt/test/tsan/tls_race2.cpp index b05547e6643f..02b789075025 100644 --- a/compiler-rt/test/tsan/tls_race2.cpp +++ b/compiler-rt/test/tsan/tls_race2.cpp @@ -34,5 +34,5 @@ int main() { // CHECK-NetBSD: Location is TLS of thread T1. // CHECK-Darwin: Location is heap block of size 4 // OHOS_LOCAL -// CHECK-OHOS: Location is heap block of size +// CHECK-OHOS: Location is TLS of thread T1. // CHECK: DONE -- Gitee