summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2018-04-11 10:20:41 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-04-11 10:20:41 +0000
commit75e46053d2083dcd197fee56abb86b4b5ec10449 (patch)
tree4c50c959e85cfffa4217fde74cb805c038d09c36
parent60d7315fb7ef4a03bf7dd13eaa729c884a52ce3c (diff)
parent29e64cfc32e17c9111a5ed2a6b141bebf891cbe3 (diff)
Merge "ART: Stop Hidden API stackwalk for class initializers in j.l.i." into pi-dev
-rw-r--r--runtime/native/java_lang_Class.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index a97a17d072..e161ed49f7 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -77,11 +77,14 @@ static bool IsCallerInPlatformDex(Thread* self) REQUIRES_SHARED(Locks::mutator_l
if (declaring_class->IsClassClass()) {
return true;
}
+ // Check classes in the java.lang.invoke package. At the time of writing, the
+ // classes of interest are MethodHandles and MethodHandles.Lookup, but this
+ // is subject to change so conservatively cover the entire package.
+ // NB Static initializers within java.lang.invoke are permitted and do not
+ // need further stack inspection.
ObjPtr<mirror::Class> lookup_class = mirror::MethodHandlesLookup::StaticClass();
- if (declaring_class == lookup_class || declaring_class->IsInSamePackage(lookup_class)) {
- // Check classes in the java.lang.invoke package. At the time of writing, the
- // classes of interest are MethodHandles and MethodHandles.Lookup, but this
- // is subject to change so conservatively cover the entire package.
+ if ((declaring_class == lookup_class || declaring_class->IsInSamePackage(lookup_class))
+ && !m->IsClassInitializer()) {
return true;
}
}