From 5fe2f34262e4dbeebee5ccc4e465b53284632e4c Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Fri, 7 Sep 2018 18:41:49 +0100 Subject: 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 --- runtime/gc/heap_verification_test.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'runtime/gc/heap_verification_test.cc') 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 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(); -- cgit v1.2.3-59-g8ed1b