From 1f3861de4cacb51eacbb624e377b9dc7d7f96cc1 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Thu, 12 Jan 2023 15:00:47 +0000 Subject: Init fault manager even if we don't install signal handlers. A few tests rely on libsigchain intercepting system calls and won't pass with default libc implementation. We did not observe any test failures previously, because all supported architectures enable optimizations that cause signal handlers to be installed. Bug: none Test: art/test.py --target -r --64 --interpreter \ 004-SignalTest \ 305-other-fault-handler # observe that the tests pass in switch interpreter mode # (disable optimizations that trigger signal handler installation) Test: art/test.py --host # ensure the case without libsigchain works Change-Id: Ie8c1cf3f5add15ccc1225c2147d13b5021ebb25c --- runtime/runtime.cc | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'runtime/runtime.cc') diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 84ec7ef710..8c0150e6a7 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1768,34 +1768,36 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { break; } - if (HandlesSignalsInCompiledCode()) { + if (!no_sig_chain_) { fault_manager.Init(); - // These need to be in a specific order. The null point check handler must be - // after the suspend check and stack overflow check handlers. - // - // Note: the instances attach themselves to the fault manager and are handled by it. The - // manager will delete the instance on Shutdown(). - if (implicit_suspend_checks_) { - new SuspensionHandler(&fault_manager); - } + if (HandlesSignalsInCompiledCode()) { + // These need to be in a specific order. The null point check handler must be + // after the suspend check and stack overflow check handlers. + // + // Note: the instances attach themselves to the fault manager and are handled by it. The + // manager will delete the instance on Shutdown(). + if (implicit_suspend_checks_) { + new SuspensionHandler(&fault_manager); + } - if (implicit_so_checks_) { - new StackOverflowHandler(&fault_manager); - } + if (implicit_so_checks_) { + new StackOverflowHandler(&fault_manager); + } - if (implicit_null_checks_) { - new NullPointerHandler(&fault_manager); - } + if (implicit_null_checks_) { + new NullPointerHandler(&fault_manager); + } - if (kEnableJavaStackTraceHandler) { - new JavaStackTraceHandler(&fault_manager); - } + if (kEnableJavaStackTraceHandler) { + new JavaStackTraceHandler(&fault_manager); + } - if (interpreter::CanRuntimeUseNterp()) { - // Nterp code can use signal handling just like the compiled managed code. - OatQuickMethodHeader* nterp_header = OatQuickMethodHeader::NterpMethodHeader; - fault_manager.AddGeneratedCodeRange(nterp_header->GetCode(), nterp_header->GetCodeSize()); + if (interpreter::CanRuntimeUseNterp()) { + // Nterp code can use signal handling just like the compiled managed code. + OatQuickMethodHeader* nterp_header = OatQuickMethodHeader::NterpMethodHeader; + fault_manager.AddGeneratedCodeRange(nterp_header->GetCode(), nterp_header->GetCodeSize()); + } } } -- cgit v1.2.3-59-g8ed1b