From 1878e582ad30fbe80f1dd7ad8d2036cb8862c998 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Tue, 12 Apr 2022 01:34:53 +0530 Subject: [PATCH] Add `ScopedStackBlocker` to `RomFile.populate` We needed to block stack frame lookups past JNI code as Java doesn't follow the ARMv8 frame pointer ABI which leads to invalid pointer dereferences. Any JNI function that throws or handles exceptions must do this now or it may lead to a `SIGSEGV`. --- app/src/main/cpp/loader_jni.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/cpp/loader_jni.cpp b/app/src/main/cpp/loader_jni.cpp index 321b93f1..ba2044c1 100644 --- a/app/src/main/cpp/loader_jni.cpp +++ b/app/src/main/cpp/loader_jni.cpp @@ -13,6 +13,8 @@ #include "skyline/jvm.h" extern "C" JNIEXPORT jint JNICALL Java_emu_skyline_loader_RomFile_populate(JNIEnv *env, jobject thiz, jint jformat, jint fd, jstring appFilesPathJstring, jint systemLanguage) { + skyline::signal::ScopedStackBlocker stackBlocker; + skyline::loader::RomFormat format{static_cast(jformat)}; skyline::Logger::SetContext(&skyline::Logger::LoaderContext);