-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[hwasan] Flush stderr/stdout in tests #114083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Thurston Dang (thurstond) ChangesThe 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. Full diff: https://github.com/llvm/llvm-project/pull/114083.diff 3 Files Affected:
diff --git a/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c b/compiler-rt/test/hwasan/TestCases/many-threads-uaf.c
index 8fa07861371d56..e02ab5b28ce046 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 78bef538af1161..da1cb686969206 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 070622f560a225..b4b79875e8111e 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.
|
This is the ASan equivalent of llvm#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.
This is the ASan equivalent of #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 ASan check is correct but it did not match the stderr/stdout output. This patch attempts to fix the issue by flushing stderr as appropriate.
3754fc1 broke the build because subsequent checks depend on the line numbers https://lab.llvm.org/buildbot/#/builders/174/builds/7534/steps/6/logs/FAIL__HWAddressSanitizer-x86_64__use-after-free_c
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/13080 Here is the relevant piece of the build log for the reference
|
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.
This is the ASan equivalent of llvm#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 ASan check is correct but it did not match the stderr/stdout output. This patch attempts to fix the issue by flushing stderr as appropriate.
)' 3754fc1 broke the build because subsequent checks depend on the line numbers https://lab.llvm.org/buildbot/#/builders/174/builds/7534/steps/6/logs/FAIL__HWAddressSanitizer-x86_64__use-after-free_c
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.