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
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc
index 0146150..47e6ca3 100644
--- a/runtime/gc/collector/semi_space.cc
+++ b/runtime/gc/collector/semi_space.cc
@@ -265,16 +265,20 @@
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::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.