[compiler-rt] 7b23552 - Fix-forward ASan on Windows.
Mitch Phillips via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 15:53:40 PDT 2022
Author: Mitch Phillips
Date: 2022-06-27T15:53:30-07:00
New Revision: 7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308
URL: https://github.com/llvm/llvm-project/commit/7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308
DIFF: https://github.com/llvm/llvm-project/commit/7b2355277950e5b42f04c0bdbc7fb8a2c4f5e308.diff
LOG: 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.
Added:
Modified:
compiler-rt/test/asan/TestCases/debug_locate.cpp
compiler-rt/test/asan/TestCases/describe_address.cpp
compiler-rt/test/asan/TestCases/global-demangle.cpp
compiler-rt/test/asan/TestCases/global-location-nodebug.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/debug_locate.cpp b/compiler-rt/test/asan/TestCases/debug_locate.cpp
index 5971a772786b..93d1af8b8391 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 868c0eb1c446..296d3fdfb26a 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 5f7ff91b1601..844a851a7722 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 1de97237ead8..6d8aa5732933 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
More information about the llvm-commits
mailing list