From 34cf832a68af33cdb1e13db658cf636ef1abae38 Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Tue, 6 Sep 2016 12:24:52 -0700 Subject: [PATCH] Disable the from-space memory protection under host debug build. Temporarily for diagnosing the odd memory protection issue on the build server. Bug: 31172841 Test: test-art-host with SS Change-Id: I31aaf3ae5b1d3bda901c6c739933b5a4751058c1 --- runtime/gc/collector/semi_space.cc | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc index 01461509d..47e6ca331 100644 --- a/runtime/gc/collector/semi_space.cc +++ b/runtime/gc/collector/semi_space.cc @@ -265,16 +265,20 @@ void SemiSpace::MarkingPhase() { RecordFree(ObjectBytePair(from_objects - to_objects, from_bytes - to_bytes)); // Clear and protect the from space. from_space_->Clear(); - if (kProtectFromSpace && !from_space_->IsRosAllocSpace()) { - // Protect with PROT_NONE. - VLOG(heap) << "Protecting from_space_ : " << *from_space_; - from_space_->GetMemMap()->Protect(PROT_NONE); - } else { - // If RosAllocSpace, we'll leave it as PROT_READ here so the - // rosaloc verification can read the metadata magic number and - // protect it with PROT_NONE later in FinishPhase(). - VLOG(heap) << "Protecting from_space_ with PROT_READ : " << *from_space_; - from_space_->GetMemMap()->Protect(PROT_READ); + // b/31172841. Temporarily disable the from-space protection with host debug build + // due to some protection issue in the build server. + if (kProtectFromSpace && !(kIsDebugBuild && !kIsTargetBuild)) { + if (!from_space_->IsRosAllocSpace()) { + // Protect with PROT_NONE. + VLOG(heap) << "Protecting from_space_ : " << *from_space_; + from_space_->GetMemMap()->Protect(PROT_NONE); + } else { + // If RosAllocSpace, we'll leave it as PROT_READ here so the + // rosaloc verification can read the metadata magic number and + // protect it with PROT_NONE later in FinishPhase(). + VLOG(heap) << "Protecting from_space_ with PROT_READ : " << *from_space_; + from_space_->GetMemMap()->Protect(PROT_READ); + } } heap_->PreSweepingGcVerification(this); if (swap_semi_spaces_) { @@ -790,9 +794,13 @@ void SemiSpace::SetFromSpace(space::ContinuousMemMapAllocSpace* from_space) { void SemiSpace::FinishPhase() { TimingLogger::ScopedTiming t(__FUNCTION__, GetTimings()); - if (kProtectFromSpace && from_space_->IsRosAllocSpace()) { - VLOG(heap) << "Protecting from_space_ with PROT_NONE : " << *from_space_; - from_space_->GetMemMap()->Protect(PROT_NONE); + // b/31172841. Temporarily disable the from-space protection with host debug build + // due to some protection issue in the build server. + if (kProtectFromSpace && !(kIsDebugBuild && !kIsTargetBuild)) { + if (from_space_->IsRosAllocSpace()) { + VLOG(heap) << "Protecting from_space_ with PROT_NONE : " << *from_space_; + from_space_->GetMemMap()->Protect(PROT_NONE); + } } // Null the "to" and "from" spaces since compacting from one to the other isn't valid until // further action is done by the heap. -- 2.11.0