[compiler-rt] edd0981 - [HWASan] unflake test
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 12 15:06:41 PDT 2023
Author: Florian Mayer
Date: 2023-05-12T15:06:31-07:00
New Revision: edd0981e71af87a686365d40e6410a8a377c153d
URL: https://github.com/llvm/llvm-project/commit/edd0981e71af87a686365d40e6410a8a377c153d
DIFF: https://github.com/llvm/llvm-project/commit/edd0981e71af87a686365d40e6410a8a377c153d.diff
LOG: [HWASan] unflake test
The short granule logic made this test flaky because with low
probability there would be no tag mismatch by coincidence.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D150484
Added:
Modified:
compiler-rt/test/hwasan/TestCases/global-with-reduction.c
Removed:
################################################################################
diff --git a/compiler-rt/test/hwasan/TestCases/global-with-reduction.c b/compiler-rt/test/hwasan/TestCases/global-with-reduction.c
index de682030ee883..b93e976c6f3ff 100644
--- a/compiler-rt/test/hwasan/TestCases/global-with-reduction.c
+++ b/compiler-rt/test/hwasan/TestCases/global-with-reduction.c
@@ -22,29 +22,36 @@
// REQUIRES: pointer-tagging
+#include <inttypes.h>
#include <stdlib.h>
+struct data {
+ uint64_t x;
+ uint64_t y;
+};
+
// GlobalOpt may replace the current GV with a new boolean-typed GV. Previously,
// this resulted in the "nosanitize" getting dropped because while the data/code
// references to the GV were updated, the old metadata references weren't.
-int* f() {
+struct data *f() {
#ifdef USE_NOSANITIZE
-__attribute__((no_sanitize("hwaddress"))) static int x = 1;
+ __attribute__((no_sanitize("hwaddress"))) static struct data x = {1, 0};
#else // USE_NOSANITIZE
- static int x = 1;
+ static struct data x = {1, 0};
#endif // USE_NOSANITIZE
- if (x == 1) x = 0;
+ if (x.x == 1)
+ x.x = 0;
return &x;
}
int main(int argc, char **argv) {
// CHECK: Cause: global-overflow
- // RSYM: is located 0 bytes after a 4-byte global variable f.x {{.*}} in {{.*}}global-with-reduction.c.tmp
- // RNOSYM: is located after a 4-byte global variable in
+ // RSYM: is located 0 bytes after a 16-byte global variable f.x {{.*}} in {{.*}}global-with-reduction.c.tmp
+ // RNOSYM: is located after a 16-byte global variable in
// RNOSYM-NEXT: #0 0x{{.*}} ({{.*}}global-with-reduction.c.tmp+{{.*}})
- // LSYM: is located 4 bytes before a 4-byte global variable f.x {{.*}} in {{.*}}global-with-reduction.c.tmp
- // LNOSYM: is located before a 4-byte global variable in
+ // LSYM: is located 16 bytes before a 16-byte global variable f.x {{.*}} in {{.*}}global-with-reduction.c.tmp
+ // LNOSYM: is located before a 16-byte global variable in
// LNOSYM-NEXT: #0 0x{{.*}} ({{.*}}global-with-reduction.c.tmp+{{.*}})
// CHECK-NOT: can not describe
- f()[atoi(argv[1])] = 1;
+ f()[atoi(argv[1])].x = 1;
}
More information about the llvm-commits
mailing list