Address comments I missed on a previous CL
I accidentally missed some comments on
android-review.googlesource.com/c/305518 when I submitted it. This
addresses those comments.
Test: mma -j40 test-art-host
Change-Id: Icd8ff65dee1730d10489f25e75bddbd455c68413
diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/runtime/openjdkjvmti/ti_redefine.cc
index 69bd887..d0349b9 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/runtime/openjdkjvmti/ti_redefine.cc
@@ -66,7 +66,8 @@
return map;
}
memcpy(map->Begin(), dex_data, data_len);
- // Make the dex files mmap read only.
+ // Make the dex files mmap read only. This matches how other DexFiles are mmaped and prevents
+ // programs from corrupting it.
map->Protect(PROT_READ);
return map;
}
diff --git a/runtime/openjdkjvmti/ti_redefine.h b/runtime/openjdkjvmti/ti_redefine.h
index f3a5834..c819acd 100644
--- a/runtime/openjdkjvmti/ti_redefine.h
+++ b/runtime/openjdkjvmti/ti_redefine.h
@@ -68,7 +68,7 @@
public:
// Redefine the given class with the given dex data. Note this function does not take ownership of
// the dex_data pointer. It is not used after this call however and may be freed if desired.
- // The caller is responsible for freeing it. The runtime makes it's own copy of the data.
+ // The caller is responsible for freeing it. The runtime makes its own copy of the data.
static jvmtiError RedefineClass(ArtJvmTiEnv* env,
art::Runtime* runtime,
art::Thread* self,
@@ -146,6 +146,7 @@
// This will check that no constraints are violated (more than 1 class in dex file, any changes in
// number/declaration of methods & fields, changes in access flags, etc.)
bool EnsureRedefinitionIsValid() {
+ LOG(WARNING) << "Redefinition is not checked for validity currently";
return true;
}