From d000480134b7b00895fbfd142f1d1e18d9cfa6e9 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 15 Oct 2014 16:59:47 -0700 Subject: Add way to ensure we are at the front of the sigaction chain Calling this after jni_on_load fixes the unity apps. This is not exactly correct since we may already have the following chain. Start up: Us -> debuggerd After app goes in front: App -> us -> debuggerd After we put ourself back at the front: Us -> app -> us -> app -> .... stack overflow. Bug: 17620677 Change-Id: I9183997e3d5ebd51c320b5d51425be5142e938f3 (cherry picked from commit 1f24296c7c8a6501ee2388c0d20b48f471b48660) --- runtime/java_vm_ext.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/java_vm_ext.cc') diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index 1444d9762a..fed8bf07be 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -21,6 +21,7 @@ #include "base/mutex.h" #include "base/stl_util.h" #include "check_jni.h" +#include "fault_handler.h" #include "indirect_reference_table-inl.h" #include "mirror/art_method.h" #include "mirror/class-inl.h" @@ -688,6 +689,10 @@ bool JavaVMExt::LoadNativeLibrary(JNIEnv* env, const std::string& path, jobject JNI_OnLoadFn jni_on_load = reinterpret_cast(sym); int version = (*jni_on_load)(this, nullptr); + if (runtime_->GetTargetSdkVersion() != 0 && runtime_->GetTargetSdkVersion() <= 21) { + fault_manager.EnsureArtActionInFrontOfSignalChain(); + } + self->SetClassLoaderOverride(old_class_loader.get()); if (version == JNI_ERR) { -- cgit v1.2.3