summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-05-02 14:58:12 +0100
committer Mathieu Chartier <mathieuc@google.com> 2018-05-10 16:17:30 -0700
commitd8860b42e47d48fcc47db9d0daf5a1b9432180a1 (patch)
treec5522fa9c6d1e9e63cb497da7dc84b72b6b11531 /runtime/class_loader_context.h
parent48af3b39cd7c8abaa7f9671191ec8260630239b2 (diff)
Do not load app image for class collisions
Even for special shared libraries that are compiled with '--class-loader-context=&', we must reject the app image if there are duplicate classes. In the case where "&" is not specified, avoid the collision check. This is safe since the class loader context check was actually run. Test: 172-app-image-twice Bug: 77342775 Bug: 79200502 Change-Id: Idc2d59166680948d4d34d0f224491f77ecad2974
Diffstat (limited to 'runtime/class_loader_context.h')
-rw-r--r--runtime/class_loader_context.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h
index 1c83007f41..a4268aa09a 100644
--- a/runtime/class_loader_context.h
+++ b/runtime/class_loader_context.h
@@ -22,8 +22,10 @@
#include "arch/instruction_set.h"
#include "base/dchecked_vector.h"
+#include "dex/dex_file.h"
#include "handle_scope.h"
#include "mirror/class_loader.h"
+#include "oat_file.h"
#include "scoped_thread_state_change.h"
namespace art {
@@ -34,6 +36,18 @@ class OatFile;
// Utility class which holds the class loader context used during compilation/verification.
class ClassLoaderContext {
public:
+ enum class VerificationResult {
+ kVerifies,
+ kForcedToSkipChecks,
+ kMismatch,
+ };
+
+ enum ClassLoaderType {
+ kInvalidClassLoader = 0,
+ kPathClassLoader = 1,
+ kDelegateLastClassLoader = 2
+ };
+
~ClassLoaderContext();
// Opens requested class path files and appends them to ClassLoaderInfo::opened_dex_files.
@@ -109,7 +123,7 @@ class ClassLoaderContext {
// This should be called after OpenDexFiles().
// Names are only verified if verify_names is true.
// Checksums are only verified if verify_checksums is true.
- bool VerifyClassLoaderContextMatch(const std::string& context_spec,
+ VerificationResult VerifyClassLoaderContextMatch(const std::string& context_spec,
bool verify_names = true,
bool verify_checksums = true) const;
@@ -141,12 +155,6 @@ class ClassLoaderContext {
static std::unique_ptr<ClassLoaderContext> Default();
private:
- enum ClassLoaderType {
- kInvalidClassLoader = 0,
- kPathClassLoader = 1,
- kDelegateLastClassLoader = 2
- };
-
struct ClassLoaderInfo {
// The type of this class loader.
ClassLoaderType type;