From 7600fa9234e02cf5108a3a82babf3d3ab82fcddd Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 15 Mar 2017 17:40:42 -0700 Subject: Make sigchain actually own the signal chain. sigchain exists to make sure that art's signal handler is at the front, but it currently does this by putting the fault manager in the actual signal handler slot and having that handler call into sigchain when it doesn't want to handle a signal. sigchain also has a "special signal handler" (used for native bridge) that runs before user handlers, but after ART's. Move maintenance of the signal chain into sigchain itself, and use the same mechanism to handle the ART handler and the native bridge handler. Also, clean up some bugs: - InvokeUserSignalHandler was using the wrapper sigprocmask instead of the actual one. - Use SIG_SETMASK instead of SIG_BLOCK between calling handlers, in case one of the handlers changes the signal mask. - Correctly handle sigaction without SA_SIGINFO. Bug: http://b/36205469 Bug: http://b/36262089 Test: NPE with dalvikvm with/without TEST_NESTED_SIGNAL defined (arm/aarch64) Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111 --- runtime/java_vm_ext.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/java_vm_ext.cc') diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index a341cdb89f..b93b8f2a97 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -39,6 +39,7 @@ #include "runtime_options.h" #include "ScopedLocalRef.h" #include "scoped_thread_state_change-inl.h" +#include "sigchain.h" #include "thread-inl.h" #include "thread_list.h" @@ -900,7 +901,8 @@ bool JavaVMExt::LoadNativeLibrary(JNIEnv* env, int version = (*jni_on_load)(this, nullptr); if (runtime_->GetTargetSdkVersion() != 0 && runtime_->GetTargetSdkVersion() <= 21) { - fault_manager.EnsureArtActionInFrontOfSignalChain(); + // Make sure that sigchain owns SIGSEGV. + EnsureFrontOfChain(SIGSEGV); } self->SetClassLoaderOverride(old_class_loader.get()); -- cgit v1.2.3-59-g8ed1b