[PR #3757] [MERGED] Core: Read-only file mmap fix #3699

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3757
Author: @StevenMiller123
Created: 10/30/2025
Status: Merged
Merged: 10/30/2025
Merged by: @squidbus

Base: mainHead: file-mmap-hotfix


📝 Commits (2)

📊 Changes

1 file changed (+14 additions, -0 deletions)

View changed files

📝 src/core/memory.cpp (+14 -0)

📄 Description

PS4s allow read-only file mmaps with read-write permissions, though attempting to write to that memory causes full system crashes and data corruption. On shadPS4, attempting to do this causes an address space assert, through either a failed mmap on Linux, or a failed MapViewOfFile3 call on Windows.

This PR fixes the address space errors by removing write permissions on mmap for read-only files.

This should fix a regression noted on Discord, and slightly improves the behavior of my memory testing suite on shadPS4.


🔄 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/3757 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 10/30/2025 **Status:** ✅ Merged **Merged:** 10/30/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `file-mmap-hotfix` --- ### 📝 Commits (2) - [`05b5822`](https://github.com/shadps4-emu/shadPS4/commit/05b5822d3d62af4d174ca0420a9fdec9d17b8d94) Extra validity checks for file mmaps - [`34e2001`](https://github.com/shadps4-emu/shadPS4/commit/34e20010dffd32ebf14d73d63d459d6bf8071928) Add comment ### 📊 Changes **1 file changed** (+14 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/core/memory.cpp` (+14 -0) </details> ### 📄 Description PS4s allow read-only file mmaps with read-write permissions, though attempting to write to that memory causes full system crashes and data corruption. On shadPS4, attempting to do this causes an address space assert, through either a failed mmap on Linux, or a failed MapViewOfFile3 call on Windows. This PR fixes the address space errors by removing write permissions on mmap for read-only files. This should fix a regression noted on Discord, and slightly improves the behavior of my [memory testing suite](https://github.com/ps4emulation/integration_tests/pull/4) on shadPS4. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:04:40 +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#3699
No description provided.