diff --git a/compiler-rt/lib/asan/tests/asan_globals_test.cc b/compiler-rt/lib/asan/tests/asan_globals_test.cc index 15e6a9a47b1d..5042ef07378d 100644 --- a/compiler-rt/lib/asan/tests/asan_globals_test.cc +++ b/compiler-rt/lib/asan/tests/asan_globals_test.cc @@ -30,6 +30,9 @@ char glob14[14]; char glob15[15]; char glob16[16]; char glob17[17]; +char glob1000[1000]; +char glob10000[10000]; +char glob100000[100000]; static char static10[10]; diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cc b/compiler-rt/lib/asan/tests/asan_noinst_test.cc index 60835346283e..b7b4a4bab899 100644 --- a/compiler-rt/lib/asan/tests/asan_noinst_test.cc +++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cc @@ -651,6 +651,9 @@ TEST(AddressSanitizerInterface, GlobalRedzones) { GOOD_ACCESS(glob15, 15 - 1); GOOD_ACCESS(glob16, 16 - 1); GOOD_ACCESS(glob17, 17 - 1); + GOOD_ACCESS(glob1000, 1000 - 1); + GOOD_ACCESS(glob10000, 10000 - 1); + GOOD_ACCESS(glob100000, 100000 - 1); BAD_ACCESS(glob1, 1); BAD_ACCESS(glob2, 2); @@ -669,6 +672,12 @@ TEST(AddressSanitizerInterface, GlobalRedzones) { BAD_ACCESS(glob15, 15); BAD_ACCESS(glob16, 16); BAD_ACCESS(glob17, 17); + BAD_ACCESS(glob1000, 1000); + BAD_ACCESS(glob1000, 1100); // Redzone is at least 101 bytes. + BAD_ACCESS(glob10000, 10000); + BAD_ACCESS(glob10000, 11000); // Redzone is at least 1001 bytes. + BAD_ACCESS(glob100000, 100000); + BAD_ACCESS(glob100000, 110000); // Redzone is at least 10001 bytes. } // Make sure that each aligned block of size "2^granularity" doesn't have diff --git a/compiler-rt/lib/asan/tests/asan_test_utils.h b/compiler-rt/lib/asan/tests/asan_test_utils.h index 31d356469234..824f7e322b66 100644 --- a/compiler-rt/lib/asan/tests/asan_test_utils.h +++ b/compiler-rt/lib/asan/tests/asan_test_utils.h @@ -103,6 +103,9 @@ extern char glob14[14]; extern char glob15[15]; extern char glob16[16]; extern char glob17[17]; +extern char glob1000[1000]; +extern char glob10000[10000]; +extern char glob100000[100000]; extern int GlobalsTest(int x); #endif // ASAN_TEST_UTILS_H