ART: Fix preverified setting in VerifyClass
Make sure soft-failed classes cannot set methods to pre-verified.
Bug: 16828525, 17465185
(cherry picked from commit 3892cf8da7d5e76c0dee585fc8f69df773680525)
Change-Id: I09c0a68ca722978459741311148eae7614f9ca49
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 42e0899..f94535c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3530,11 +3530,13 @@
ObjectLock<mirror::Class> lock(self, klass);
// Don't attempt to re-verify if already sufficiently verified.
- if (klass->IsVerified() ||
- (klass->IsCompileTimeVerified() && Runtime::Current()->IsCompiler())) {
+ if (klass->IsVerified()) {
EnsurePreverifiedMethods(klass);
return;
}
+ if (klass->IsCompileTimeVerified() && Runtime::Current()->IsCompiler()) {
+ return;
+ }
// The class might already be erroneous, for example at compile time if we attempted to verify
// this class as a parent to another.
@@ -3641,6 +3643,9 @@
klass->SetStatus(mirror::Class::kStatusRetryVerificationAtRuntime, self);
} else {
klass->SetStatus(mirror::Class::kStatusVerified, self);
+ // As this is a fake verified status, make sure the methods are _not_ marked preverified
+ // later.
+ klass->SetAccessFlags(klass->GetAccessFlags() | kAccPreverified);
}
}
} else {