summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2018-09-07 18:41:49 +0100
committer Roland Levillain <rpl@google.com> 2018-09-07 18:42:33 +0100
commit5fe2f34262e4dbeebee5ccc4e465b53284632e4c (patch)
treef4845ab3d659d06f569ed72cb6a66bf83b3c9222
parentd176e93d66df409e2eee5343efd26b35c73fb71b (diff)
Disable some tests in heap_verification_test when running with ASan.
Now that the String class is allocated in the non-moving space when the runtime is running without a boot image (which is the case in some of the test cases in heap_verification_test), some unexpressed assumptions about the accessibility of the memory around the String class object may no longer hold (there may be poisoned areas before and after the String class). When running with AddressSanizer, those cases will trigger a use-after-poison error. Disable those test cases when running with ASan. Test: SANITIZE_HOST=address art/test.py Bug: 68181300 Bug: 67628039 Change-Id: Ia9b0e6254257afa82686bd33a5e421c5096ce712
-rw-r--r--runtime/gc/heap_verification_test.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/runtime/gc/heap_verification_test.cc b/runtime/gc/heap_verification_test.cc
index 6caca84854..375412930b 100644
--- a/runtime/gc/heap_verification_test.cc
+++ b/runtime/gc/heap_verification_test.cc
@@ -83,7 +83,12 @@ TEST_F(VerificationTest, IsValidClassOrNotInHeap) {
}
TEST_F(VerificationTest, IsValidClassInHeap) {
- TEST_DISABLED_FOR_MEMORY_TOOL_WITH_HEAP_POISONING();
+ // Now that the String class is allocated in the non-moving space when the
+ // runtime is running without a boot image (which is the case in this gtest),
+ // and we run with AddressSanizer, it is possible that the (presumably
+ // invalid) memory location `uint_klass - kObjectAlignment` tested below is
+ // poisoned when running with AddressSanizer. Disable this test in that case.
+ TEST_DISABLED_FOR_MEMORY_TOOL();
ScopedObjectAccess soa(Thread::Current());
VariableSizedHandleScope hs(soa.Self());
Handle<mirror::String> string(
@@ -106,7 +111,13 @@ TEST_F(VerificationTest, DumpInvalidObjectInfo) {
}
TEST_F(VerificationTest, DumpValidObjectInfo) {
- TEST_DISABLED_FOR_MEMORY_TOOL_WITH_HEAP_POISONING();
+ // Now that the String class is allocated in the non-moving space when the
+ // runtime is running without a boot image (which is the case in this gtest),
+ // and we run with AddressSanizer, it is possible that the calls to
+ // Verification::DumpObjectInfo below involving the String class object
+ // (`string->GetClass()`, `uint_klass`, etc.) access poisoned memory when they
+ // call Verification::DumpRAMAroundAddress. Disable this test in that case.
+ TEST_DISABLED_FOR_MEMORY_TOOL();
ScopedLogSeverity sls(LogSeverity::INFO);
ScopedObjectAccess soa(Thread::Current());
Runtime* const runtime = Runtime::Current();
@@ -126,7 +137,13 @@ TEST_F(VerificationTest, DumpValidObjectInfo) {
}
TEST_F(VerificationTest, LogHeapCorruption) {
- TEST_DISABLED_FOR_MEMORY_TOOL_WITH_HEAP_POISONING();
+ // Now that the String class is allocated in the non-moving space when the
+ // runtime is running without a boot image (which is the case in this gtest),
+ // and we run with AddressSanizer, it is possible that the call to
+ // Verification::LogHeapCorruption below involving the String class object
+ // (`string->GetClass()`) accesses poisoned memory when it calls
+ // Verification::DumpRAMAroundAddress. Disable this test in that case.
+ TEST_DISABLED_FOR_MEMORY_TOOL();
ScopedLogSeverity sls(LogSeverity::INFO);
ScopedObjectAccess soa(Thread::Current());
Runtime* const runtime = Runtime::Current();