From bde271566b7ff1b83d65c548b0fa8d9c1b1fc6fb Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 29 Oct 2020 01:42:14 +1000 Subject: [PATCH] Common/PageFaultHandler: Hook SIGBUS as well as SIGSEGV on AArch64 Apparently this happens too? --- src/common/page_fault_handler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/page_fault_handler.cpp b/src/common/page_fault_handler.cpp index e0125759c..b58ab6afb 100644 --- a/src/common/page_fault_handler.cpp +++ b/src/common/page_fault_handler.cpp @@ -105,7 +105,7 @@ static LONG ExceptionHandler(PEXCEPTION_POINTERS exi) #elif defined(USE_SIGSEGV) static struct sigaction s_old_sigsegv_action; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__aarch64__) static struct sigaction s_old_sigbus_action; #endif @@ -155,7 +155,7 @@ static void SIGSEGVHandler(int sig, siginfo_t* info, void* ctx) } // call old signal handler -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__aarch64__) const struct sigaction& sa = s_old_sigsegv_action; #else const struct sigaction& sa = (sig == SIGBUS) ? s_old_sigbus_action : s_old_sigsegv_action; @@ -218,7 +218,7 @@ bool InstallHandler(void* owner, Callback callback) Log_ErrorPrintf("sigaction(SIGSEGV) failed: %d", errno); return false; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__aarch64__) if (sigaction(SIGBUS, &sa, &s_old_sigbus_action) < 0) { Log_ErrorPrintf("sigaction(SIGBUS) failed: %d", errno); @@ -251,7 +251,7 @@ bool RemoveHandler(void* owner) s_veh_handle = nullptr; #else // restore old signal handler -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__aarch64__) if (sigaction(SIGBUS, &s_old_sigbus_action, nullptr) < 0) { Log_ErrorPrintf("sigaction(SIGBUS) failed: %d", errno);