diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index 37d7db9e0..ad02216c5 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -1,3 +1,4 @@ +#include "align.hpp" #include "amdgpu/bridge/bridge.hpp" #include "backtrace.hpp" #include "bridge.hpp" @@ -85,14 +86,15 @@ handle_signal(int sig, siginfo_t *info, void *ucontext) { static void setupSigHandlers() { stack_t ss; - - ss.ss_sp = malloc(SIGSTKSZ); + auto sigStackSize = std::max( + SIGSTKSZ, utils::alignUp(8 * 1024 * 1024, sysconf(_SC_PAGE_SIZE))); + ss.ss_sp = malloc(sigStackSize); if (ss.ss_sp == NULL) { perror("malloc"); exit(EXIT_FAILURE); } - ss.ss_size = SIGSTKSZ; + ss.ss_size = sigStackSize; ss.ss_flags = 0; if (sigaltstack(&ss, NULL) == -1) { diff --git a/rpcsx-os/ops.cpp b/rpcsx-os/ops.cpp index 099a420c1..bd276285a 100644 --- a/rpcsx-os/ops.cpp +++ b/rpcsx-os/ops.cpp @@ -1,4 +1,5 @@ #include "ops.hpp" +#include "align.hpp" #include "io-device.hpp" #include "linker.hpp" #include "orbis/module/ModuleHandle.hpp" @@ -473,13 +474,16 @@ SysResult thr_new(orbis::Thread *thread, orbis::ptr param, std::thread{[=, childThread = Ref(childThread)] { stack_t ss; - ss.ss_sp = malloc(SIGSTKSZ); + auto sigStackSize = std::max( + SIGSTKSZ, ::utils::alignUp(8 * 1024 * 1024, sysconf(_SC_PAGE_SIZE))); + + ss.ss_sp = malloc(sigStackSize); if (ss.ss_sp == NULL) { perror("malloc"); exit(EXIT_FAILURE); } - ss.ss_size = SIGSTKSZ; + ss.ss_size = sigStackSize; ss.ss_flags = 0; if (sigaltstack(&ss, NULL) == -1) {