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`.
This commit is contained in:
PixelyIon 2022-04-12 01:34:53 +05:30
parent 68e693d9f4
commit 1878e582ad

View File

@ -13,6 +13,8 @@
#include "skyline/jvm.h" #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) { 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<skyline::loader::RomFormat>(jformat)}; skyline::loader::RomFormat format{static_cast<skyline::loader::RomFormat>(jformat)};
skyline::Logger::SetContext(&skyline::Logger::LoaderContext); skyline::Logger::SetContext(&skyline::Logger::LoaderContext);