[PR #3991] [MERGED] Prevent posix_pthread_mutexattr_settype from setting invalid mutex types #3851

Closed
opened 2026-02-27 22:05:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3991
Author: @Spirtix
Created: 2/3/2026
Status: Merged
Merged: 2/3/2026
Merged by: @georgemoralis

Base: mainHead: fix-mutex-settype


📝 Commits (1)

  • 735ff6e Prevent posix_pthread_mutexattr_settype from setting invalid mutex types

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 src/core/libraries/kernel/threads/mutex.cpp (+2 -1)

📄 Description

Some games like NHL17 (CUSA04326) pass 0 as the mutex type to posix_pthread_mutexattr_settype, which resets its recursive mutexes and causes them to behave incorrectly. The real ps4 kernel rejects this value.

I tested this on NHL17 and managed to get past the initial loading screen without any more race conditions caused by broken mutexes. It now crashes later in some video code...


🔄 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/3991 **Author:** [@Spirtix](https://github.com/Spirtix) **Created:** 2/3/2026 **Status:** ✅ Merged **Merged:** 2/3/2026 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `fix-mutex-settype` --- ### 📝 Commits (1) - [`735ff6e`](https://github.com/shadps4-emu/shadPS4/commit/735ff6e52c7cfb061060e36b020384afa25eb951) Prevent posix_pthread_mutexattr_settype from setting invalid mutex types ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/threads/mutex.cpp` (+2 -1) </details> ### 📄 Description Some games like NHL17 (CUSA04326) pass `0` as the mutex type to `posix_pthread_mutexattr_settype`, which resets its recursive mutexes and causes them to behave incorrectly. The real ps4 kernel rejects this value. I tested this on NHL17 and managed to get past the initial loading screen without any more race conditions caused by broken mutexes. It now crashes later in some video code... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:05:12 +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#3851
No description provided.