From 6b2018f4b847a60f39c86d67e1cae8a00ce977bc Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Thu, 4 May 2017 13:55:28 -0700 Subject: sigchain: limit use of SetHandlingSignal. The native bridge and user signal handlers are able to not return to our signal handler, leaving the HandlingSignal flag set to true for the rest of the lifetime of the thread. Fix this by only using SetHandlingSignal for handlers that we know will return (i.e. the ART fault handler). This effectively reverts commit 90444558, which means sigprocmask's behavior is back to filtering out claimed signals when inside a user signal handler. Include an update to test/115-native-bridge from Zhenhua Wang, to make sure we keep handling signals when a signal handler longjmps away instead of returning. Bug: http://b/37988407 Test: m test-art-host Test: m test-art-target Change-Id: Ia7159ddfa38f1f055e5cd6089c849a208d335752 --- runtime/fault_handler.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'runtime/fault_handler.cc') diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc index 7f738bf5a9..5594f4dfc7 100644 --- a/runtime/fault_handler.cc +++ b/runtime/fault_handler.cc @@ -129,7 +129,21 @@ FaultManager::~FaultManager() { void FaultManager::Init() { CHECK(!initialized_); - AddSpecialSignalHandlerFn(SIGSEGV, art_fault_handler); + sigset_t mask; + sigfillset(&mask); + sigdelset(&mask, SIGABRT); + sigdelset(&mask, SIGBUS); + sigdelset(&mask, SIGFPE); + sigdelset(&mask, SIGILL); + sigdelset(&mask, SIGSEGV); + + SigchainAction sa = { + .sc_sigaction = art_fault_handler, + .sc_mask = mask, + .sc_flags = 0UL, + }; + + AddSpecialSignalHandlerFn(SIGSEGV, &sa); initialized_ = true; } -- cgit v1.2.3-59-g8ed1b