[compiler-rt] 7a3fb71 - [hwasan] Fix TestCases/thread-uaf.c.
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 14 15:03:27 PDT 2021
Author: Evgenii Stepanov
Date: 2021-10-14T14:56:57-07:00
New Revision: 7a3fb71c3cbdd80666335fa8f6f071b43f0b922a
URL: https://github.com/llvm/llvm-project/commit/7a3fb71c3cbdd80666335fa8f6f071b43f0b922a
DIFF: https://github.com/llvm/llvm-project/commit/7a3fb71c3cbdd80666335fa8f6f071b43f0b922a.diff
LOG: [hwasan] Fix TestCases/thread-uaf.c.
On newer glibc, this test detects an extra match somewhere under
pthread_getattr_np. This results in Thread: lines getting spread out in
the report and failing to match the CHECKs.
Fix the CHECKs to allow this possibility.
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D111841
Added:
Modified:
compiler-rt/test/hwasan/TestCases/thread-uaf.c
Removed:
################################################################################
diff --git a/compiler-rt/test/hwasan/TestCases/thread-uaf.c b/compiler-rt/test/hwasan/TestCases/thread-uaf.c
index c368882f45896..ea3820e8c12e3 100644
--- a/compiler-rt/test/hwasan/TestCases/thread-uaf.c
+++ b/compiler-rt/test/hwasan/TestCases/thread-uaf.c
@@ -1,6 +1,8 @@
// Tests UAF detection where Allocate/Deallocate/Use
// happen in separate threads.
-// RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clang_hwasan %s -o %t && not %run %t > %t.out 2>&1
+// RUN: cat %t.out | FileCheck %s
+// RUN: cat %t.out | FileCheck --check-prefix=CHECK-THREAD %s
// REQUIRES: stable-runtime
#include <pthread.h>
@@ -35,10 +37,10 @@ void *Use(void *arg) {
// CHECK: in Deallocate
// CHECK: previously allocated here:
// CHECK: in Allocate
- // CHECK-DAG: Thread: T2 0x
- // CHECK-DAG: Thread: T3 0x
- // CHECK-DAG: Thread: T0 0x
- // CHECK-DAG: Thread: T1 0x
+ // CHECK-THREAD-DAG: Thread: T2 0x
+ // CHECK-THREAD-DAG: Thread: T3 0x
+ // CHECK-THREAD-DAG: Thread: T0 0x
+ // CHECK-THREAD-DAG: Thread: T1 0x
__sync_fetch_and_add(&state, 1);
return NULL;
}
More information about the llvm-commits
mailing list