diff options
author | Thurston Dang <thurston@google.com> | 2024-10-29 12:38:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-29 12:38:56 -0700 |
commit | 3754fc1e9af38951aa00181c0e8110174d3f94fd (patch) | |
tree | 11d3d180a2479ea7cbdb25f3d2d90ff0652e448c | |
parent | a18af41c20ac9ca22e3c95da3d71475f9f6c31b5 (diff) | |
download | llvm-3754fc1e9af38951aa00181c0e8110174d3f94fd.zip llvm-3754fc1e9af38951aa00181c0e8110174d3f94fd.tar.gz llvm-3754fc1e9af38951aa00181c0e8110174d3f94fd.tar.bz2 |
[hwasan] Flush stderr/stdout in tests (#114083)
The x86_64_lam_qemu buildbots started failing
(https://lab.llvm.org/buildbot/#/builders/139/builds/5462/steps/2/logs/stdio).
Based on the logs, it appears the HWASan check is correct but it did not
match the stderr/stdout output. This patch attempts to fix the issue by
flushing stderr/stdout as appropriate.
-rw-r--r-- | compiler-rt/test/hwasan/TestCases/many-threads-uaf.c | 1 | ||||
-rw-r--r-- | compiler-rt/test/hwasan/TestCases/mem-intrinsics.c | 1 | ||||
-rw-r--r-- | compiler-rt/test/hwasan/TestCases/use-after-free.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c b/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c index 8fa0786..e02ab5b2 100644 --- a/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c +++ b/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c @@ -23,6 +23,7 @@ void *BoringThread(void *arg) { void *UAFThread(void *arg) { char * volatile x = (char*)malloc(10); fprintf(stderr, "ZZZ %p\n", x); + fflush(stderr); free(x); x[5] = 42; // CHECK: ERROR: HWAddressSanitizer: tag-mismatch on address diff --git a/compiler-rt/test/hwasan/TestCases/mem-intrinsics.c b/compiler-rt/test/hwasan/TestCases/mem-intrinsics.c index 78bef53..da1cb68 100644 --- a/compiler-rt/test/hwasan/TestCases/mem-intrinsics.c +++ b/compiler-rt/test/hwasan/TestCases/mem-intrinsics.c @@ -21,6 +21,7 @@ int main() { memcpy(Q, P, 32); #endif write(STDOUT_FILENO, "recovered\n", 10); + fflush(stdout); // WRITE: ERROR: HWAddressSanitizer: tag-mismatch on address // WRITE: WRITE of size 32 at {{.*}} tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem) // WRITE: Invalid access starting at offset 16 diff --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c index 070622f..b4b7987 100644 --- a/compiler-rt/test/hwasan/TestCases/use-after-free.c +++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c @@ -15,6 +15,7 @@ int main() { free(x); __hwasan_disable_allocator_tagging(); fprintf(stderr, ISREAD ? "Going to do a READ\n" : "Going to do a WRITE\n"); + fflush(stderr); // CHECK: Going to do a [[TYPE:[A-Z]*]] int r = 0; if (ISREAD) r = x[5]; else x[5] = 42; // should be on the same line. |