Skip to content

Commit 7b23552

Browse files
committed
Fix-forward ASan on Windows.
D127911 deleted llvm.asan.globals. This had a side effect that we no longer generated the `name` field for the `__asan_global` descriptor from clang's decscription of the name, but the demangled name from the LLVM IR. On Linux, this is the same as the clang-provided name. On Windows, this includes the type, as the name in the IR is the mangled name. Attempt #1 to fix-forward the Windows bots by making the tests glob both sides of the global name, thereby allowing types in the descriptor name.
1 parent 53217ec commit 7b23552

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

compiler-rt/test/asan/TestCases/debug_locate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ int main() {
2323

2424
type = __asan_locate_address(&global_var, name, 100,
2525
&region_address, &region_size);
26-
assert(0 == strcmp(name, "global_var"));
26+
assert(nullptr != strstr(name, "global_var"));
2727
assert(0 == strcmp(type, "global"));
2828
assert(region_address == &global_var);
2929
assert(region_size == sizeof(global_var));
3030

3131
type = __asan_locate_address((char *)(&global_var)+1, name, 100,
3232
&region_address, &region_size);
33-
assert(0 == strcmp(name, "global_var"));
33+
assert(nullptr != strstr(name, "global_var"));
3434
assert(0 == strcmp(type, "global"));
3535
assert(region_address == &global_var);
3636
assert(region_size == sizeof(global_var));

compiler-rt/test/asan/TestCases/describe_address.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main(int argc, char *argv[]) {
1313
__asan_describe_address(&stack);
1414
// CHECK: Address {{.*}} is located in stack of thread T{{.*}} at offset {{.*}}
1515
__asan_describe_address(&global);
16-
// CHECK: {{.*}} is located 0 bytes inside of global variable 'global'
16+
// CHECK: {{.*}} is located 0 bytes inside of global variable '{{.*}}global{{.*}}'
1717
delete[] heap;
1818
return 0;
1919
}

compiler-rt/test/asan/TestCases/global-demangle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ int main(int argc, char **argv) {
1212
return (int)XXX::YYY::ZZZ[argc + 5]; // BOOM
1313
// CHECK: {{READ of size 1 at 0x.*}}
1414
// CHECK: {{0x.* is located 2 bytes to the right of global variable}}
15-
// CHECK: 'XXX::YYY::ZZZ' {{.*}} of size 4
16-
// CHECK: 'XXX::YYY::ZZZ' is ascii string 'abc'
15+
// CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' {{.*}} of size 4
16+
// CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' is ascii string 'abc'
1717
}

compiler-rt/test/asan/TestCases/global-location-nodebug.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// XFAIL: solaris
1313

1414
// CHECK: AddressSanitizer: global-buffer-overflow
15-
// CLASS_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable 'C::array' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
16-
// GLOB-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable 'global' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
17-
// FUNC_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable 'main::array' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
15+
// CLASS_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}C::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
16+
// GLOB-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}global{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
17+
// FUNC_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}main::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40
1818
// LITERAL-NO-G: 0x{{.*}} is located 0 bytes to the right of global variable {{.*}} defined in '{{.*}}global-location.cpp' {{.*}} of size 11
1919
// CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow

0 commit comments

Comments
 (0)