[PR #1724] [MERGED] thread: Apply alternate signal stack to created threads. #2262

Closed
opened 2026-02-27 21:15:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1724
Author: @squidbus
Created: 12/10/2024
Status: Merged
Merged: 12/10/2024
Merged by: @raphaelthegreat

Base: mainHead: sigstack


📝 Commits (1)

  • c99c764 thread: Apply alternate signal stack to created threads.

📊 Changes

2 files changed (+28 additions, -3 deletions)

View changed files

📝 src/core/thread.cpp (+27 -3)
📝 src/core/thread.h (+1 -0)

📄 Description

With guest stacks in place, if the guest asks for a very small stack size we may overflow the stack in our signal handling. Notably this can happen to more threads on macOS, since we use signal handlers more heavily for patching a few instructions not supported by Rosetta 2.

To solve this, apply an alternate signal stack to each thread created. When signal handlers execute they will switch to this alternate stack instead of executing on the thread stack.

Fixes crashes launching CUSA04551 (NieR:Automata) on macOS, probably helps Linux and some other games as well.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/1724 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 12/10/2024 **Status:** ✅ Merged **Merged:** 12/10/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `sigstack` --- ### 📝 Commits (1) - [`c99c764`](https://github.com/shadps4-emu/shadPS4/commit/c99c764817499770a318e24ae1abfd75d17c8fd0) thread: Apply alternate signal stack to created threads. ### 📊 Changes **2 files changed** (+28 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/core/thread.cpp` (+27 -3) 📝 `src/core/thread.h` (+1 -0) </details> ### 📄 Description With guest stacks in place, if the guest asks for a very small stack size we may overflow the stack in our signal handling. Notably this can happen to more threads on macOS, since we use signal handlers more heavily for patching a few instructions not supported by Rosetta 2. To solve this, apply an alternate signal stack to each thread created. When signal handlers execute they will switch to this alternate stack instead of executing on the thread stack. Fixes crashes launching CUSA04551 (NieR:Automata) on macOS, probably helps Linux and some other games as well. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:15:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2262
No description provided.