summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Class.cc
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2018-04-10 14:32:35 +0100
committer Orion Hodson <oth@google.com> 2018-04-11 11:47:16 +0100
commitc0d988a9b5f2c34072fff100af9bd12464a6c55b (patch)
tree1bd0cf8026f3f98c04f9a8445ee034762a1dbe23 /runtime/native/java_lang_Class.cc
parent9574f493cb072466b7b491de97c381e6c2b8b639 (diff)
ART: Stop Hidden API stackwalk for class initializers in j.l.i.
Class initializers in java.lang.invoke retrieve field offsets. The hiddenapi stack walk does not need to progress past these initializers as they are permitted irrespective of how their invocation is triggered. Bug: 77631986 Test: art/test/run-test --host --64 674-hiddenapi (cherry picked from commit 29e64cfc32e17c9111a5ed2a6b141bebf891cbe3) Change-Id: I77a29999177850bd50ca4d043b0cd40c40692fe4 Merged-In: Iaabedc9c016d546e10072107d79c7b6701582c83
Diffstat (limited to 'runtime/native/java_lang_Class.cc')
-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 510c5de7ed..bfd7f69cef 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;
}
}