diff options
author | Mitch Phillips <31459023+hctim@users.noreply.github.com> | 2022-06-27 15:51:14 -0700 |
---|---|---|
committer | Mitch Phillips <31459023+hctim@users.noreply.github.com> | 2022-06-27 15:53:30 -0700 |
commit | 7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308 (patch) | |
tree | 23ad0961d0f11ee8c76b0a6548830d192ee6ee27 | |
parent | 53217ecb882c25bb69e6065512a0627828d6e870 (diff) | |
download | llvm-7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308.zip llvm-7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308.tar.gz llvm-7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308.tar.bz2 |
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.
4 files changed, 8 insertions, 8 deletions
diff --git a/compiler-rt/test/asan/TestCases/debug_locate.cpp b/compiler-rt/test/asan/TestCases/debug_locate.cpp index 5971a772..93d1af8 100644 --- a/compiler-rt/test/asan/TestCases/debug_locate.cpp +++ b/compiler-rt/test/asan/TestCases/debug_locate.cpp @@ -23,14 +23,14 @@ int main() { type = __asan_locate_address(&global_var, name, 100, ®ion_address, ®ion_size); - assert(0 == strcmp(name, "global_var")); + assert(nullptr != strstr(name, "global_var")); assert(0 == strcmp(type, "global")); assert(region_address == &global_var); assert(region_size == sizeof(global_var)); type = __asan_locate_address((char *)(&global_var)+1, name, 100, ®ion_address, ®ion_size); - assert(0 == strcmp(name, "global_var")); + assert(nullptr != strstr(name, "global_var")); assert(0 == strcmp(type, "global")); assert(region_address == &global_var); assert(region_size == sizeof(global_var)); diff --git a/compiler-rt/test/asan/TestCases/describe_address.cpp b/compiler-rt/test/asan/TestCases/describe_address.cpp index 868c0eb..296d3fd 100644 --- a/compiler-rt/test/asan/TestCases/describe_address.cpp +++ b/compiler-rt/test/asan/TestCases/describe_address.cpp @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) { __asan_describe_address(&stack); // CHECK: Address {{.*}} is located in stack of thread T{{.*}} at offset {{.*}} __asan_describe_address(&global); - // CHECK: {{.*}} is located 0 bytes inside of global variable 'global' + // CHECK: {{.*}} is located 0 bytes inside of global variable '{{.*}}global{{.*}}' delete[] heap; return 0; } diff --git a/compiler-rt/test/asan/TestCases/global-demangle.cpp b/compiler-rt/test/asan/TestCases/global-demangle.cpp index 5f7ff91..844a851 100644 --- a/compiler-rt/test/asan/TestCases/global-demangle.cpp +++ b/compiler-rt/test/asan/TestCases/global-demangle.cpp @@ -12,6 +12,6 @@ int main(int argc, char **argv) { return (int)XXX::YYY::ZZZ[argc + 5]; // BOOM // CHECK: {{READ of size 1 at 0x.*}} // CHECK: {{0x.* is located 2 bytes to the right of global variable}} - // CHECK: 'XXX::YYY::ZZZ' {{.*}} of size 4 - // CHECK: 'XXX::YYY::ZZZ' is ascii string 'abc' + // CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' {{.*}} of size 4 + // CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' is ascii string 'abc' } diff --git a/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp b/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp index 1de9723..6d8aa57 100644 --- a/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp +++ b/compiler-rt/test/asan/TestCases/global-location-nodebug.cpp @@ -12,8 +12,8 @@ // XFAIL: solaris // CHECK: AddressSanitizer: global-buffer-overflow -// 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 -// GLOB-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable 'global' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 -// 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 +// 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 +// GLOB-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}global{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 +// 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 // LITERAL-NO-G: 0x{{.*}} is located 0 bytes to the right of global variable {{.*}} defined in '{{.*}}global-location.cpp' {{.*}} of size 11 // CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow |