Fix crashes due to SEGV_ACCERR check

On certain devices, accesses to a protected memory region can return `si_code` as non-`SEGV_ACCERR` values, this leads to a crash as we only pass access violations to the trap handler and would lead to not doing so on those devices which would then result in going to the crash handler.
This commit is contained in:
PixelyIon 2022-03-07 01:01:31 +05:30
parent 0849d8b116
commit f2faa74707

View File

@ -76,7 +76,7 @@ namespace skyline::nce {
auto &mctx{ctx->uc_mcontext}; auto &mctx{ctx->uc_mcontext};
const auto &state{*reinterpret_cast<ThreadContext *>(*tls)->state}; const auto &state{*reinterpret_cast<ThreadContext *>(*tls)->state};
if (signal == SIGSEGV && info->si_code == SEGV_ACCERR) if (signal == SIGSEGV)
// If we get a guest access violation then we want to handle any accesses that may be from a trapped region // If we get a guest access violation then we want to handle any accesses that may be from a trapped region
if (state.nce->TrapHandler(reinterpret_cast<u8 *>(info->si_addr), true)) if (state.nce->TrapHandler(reinterpret_cast<u8 *>(info->si_addr), true))
return; return;