diff options
author | Brian Carlstrom <bdc@google.com> | 2012-03-29 17:52:00 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2012-03-29 17:52:04 -0700 |
commit | 58cbbc25c91b96f4766c66cefa0a0cf6ba7b1d45 (patch) | |
tree | ca81d9634ac2443bf3d9484eda1fc03ea73de175 | |
parent | 68aefb06c449df0bd8a34f3491f7594ee3f9dd0b (diff) | |
download | art-58cbbc25c91b96f4766c66cefa0a0cf6ba7b1d45.zip art-58cbbc25c91b96f4766c66cefa0a0cf6ba7b1d45.tar.gz art-58cbbc25c91b96f4766c66cefa0a0cf6ba7b1d45.tar.bz2 |
Do not use FindOatFileFromOatLocation in DexFile_isDexOptNeeded
isDexOptNeeded is trying to sniff out bad files and
FindOatFileFromOatLocation will register the file on the opened oat
file list so later if the same process tries to run code from one of
the oats, it will find it already opened and not validate its contents
are up-to-date. This happens in the special case of the system server
which is responsible for scanning to make sure things are up-to-date
proactively, but also starts up services using those files.
Change-Id: Ia9b483a46336b46bc1ec22180e60099e74886927
-rw-r--r-- | src/dalvik_system_DexFile.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc index 2539c92..a4b270d 100644 --- a/src/dalvik_system_DexFile.cc +++ b/src/dalvik_system_DexFile.cc @@ -197,8 +197,8 @@ static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename // A user build looks like this, and it will have no classes.dex in // the input for checksum validation. std::string oat_filename(OatFile::DexFilenameToOatFilename(filename.c_str())); - const OatFile* oat_file = class_linker->FindOatFileFromOatLocation(oat_filename); - if (oat_file != NULL && oat_file->GetOatDexFile(filename.c_str()) != NULL) { + UniquePtr<const OatFile> oat_file(OatFile::Open(oat_filename, oat_filename, NULL)); + if (oat_file.get() != NULL && oat_file->GetOatDexFile(filename.c_str()) != NULL) { if (debug_logging) { LOG(INFO) << "DexFile_isDexOptNeeded ignoring precompiled file: " << filename.c_str(); } @@ -207,8 +207,8 @@ static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename // Check if we have an oat file in the cache std::string cache_location(GetArtCacheFilenameOrDie(oat_filename)); - oat_file = class_linker->FindOatFileFromOatLocation(cache_location); - if (oat_file == NULL) { + oat_file.reset(OatFile::Open(cache_location, oat_filename, NULL)); + if (oat_file.get() == NULL) { LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location << " does not exist for " << filename.c_str(); return JNI_TRUE; |