Skip to content

Commit 7a3fb71

Browse files
committed
[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
1 parent 039096e commit 7a3fb71

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler-rt/test/hwasan/TestCases/thread-uaf.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Tests UAF detection where Allocate/Deallocate/Use
22
// happen in separate threads.
3-
// RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s
3+
// RUN: %clang_hwasan %s -o %t && not %run %t > %t.out 2>&1
4+
// RUN: cat %t.out | FileCheck %s
5+
// RUN: cat %t.out | FileCheck --check-prefix=CHECK-THREAD %s
46
// REQUIRES: stable-runtime
57

68
#include <pthread.h>
@@ -35,10 +37,10 @@ void *Use(void *arg) {
3537
// CHECK: in Deallocate
3638
// CHECK: previously allocated here:
3739
// CHECK: in Allocate
38-
// CHECK-DAG: Thread: T2 0x
39-
// CHECK-DAG: Thread: T3 0x
40-
// CHECK-DAG: Thread: T0 0x
41-
// CHECK-DAG: Thread: T1 0x
40+
// CHECK-THREAD-DAG: Thread: T2 0x
41+
// CHECK-THREAD-DAG: Thread: T3 0x
42+
// CHECK-THREAD-DAG: Thread: T0 0x
43+
// CHECK-THREAD-DAG: Thread: T1 0x
4244
__sync_fetch_and_add(&state, 1);
4345
return NULL;
4446
}

0 commit comments

Comments
 (0)