[asan] run-time tests for adaptive redzones

llvm-svn: 173336
This commit is contained in:
Kostya Serebryany 2013-01-24 10:36:11 +00:00
parent 87191f6221
commit 35fb1167b0
3 changed files with 15 additions and 0 deletions

View File

@ -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];

View File

@ -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

View File

@ -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