From 9406c43b2de9b94b6d70f82474840eccd7699dc7 Mon Sep 17 00:00:00 2001 From: Andrei-Valentin Onea Date: Tue, 14 Jan 2020 15:40:09 +0000 Subject: Revert "Harden hidden api checks." Revert submission 1203343-hidden-api-check-hardening Reason for revert: art-asan target failure Reverted Changes: I5af9f79f5: Add change id for hidden api check hardening Ifc8d39ba2: Harden hidden api checks. Change-Id: Ifb824ff00cb78f03cd388c56dd7411f5c51bb531 --- runtime/native/java_lang_Class.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'runtime/native/java_lang_Class.cc') diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc index 11399c07ba..da87713d54 100644 --- a/runtime/native/java_lang_Class.cc +++ b/runtime/native/java_lang_Class.cc @@ -55,17 +55,12 @@ namespace art { -// Should be the same as dalvik.system.VMRuntime.HIDDEN_API_CHECK_HARDENING. -// Corresponds to a bug id. -static constexpr uint64_t kHiddenApiCheckHardeningId = 142365358; - // Walks the stack, finds the caller of this reflective call and returns // a hiddenapi AccessContext formed from its declaring class. static hiddenapi::AccessContext GetReflectionCaller(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) { - // Walk the stack and find the first frame not from java.lang.Class, - // java.lang.invoke or java.lang.reflect. This is very expensive. - // Save this till the last. + // Walk the stack and find the first frame not from java.lang.Class and not + // from java.lang.invoke. This is very expensive. Save this till the last. struct FirstExternalCallerVisitor : public StackVisitor { explicit FirstExternalCallerVisitor(Thread* thread) : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames), @@ -98,13 +93,6 @@ static hiddenapi::AccessContext GetReflectionCaller(Thread* self) && !m->IsClassInitializer()) { return true; } - // Check for classes in the java.lang.reflect package. - if (Runtime::Current()->isChangeEnabled(kHiddenApiCheckHardeningId)) { - ObjPtr method_class = GetClassRoot(); - if (declaring_class->IsInSamePackage(method_class)) { - return true; - } - } } caller = m; -- cgit v1.2.3-59-g8ed1b