loader: retry a fault on memory the guest map reports as committed #435
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!435
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/435/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@CheesyPoofs346 on GitHub · 2026-08-31 22:45 UTC · original
CheesyPoofs346:fix/retry-transient-map-faults→main· +22 −0 · 1 files · 1 commits · closed without mergingSummary
Problem
MapBacking/UnmapBackingremap guest memory through placeholders, so there is a short window in which the pages are not mapped. A guest thread that touches the range during that window takes an access violation on memory that is committed both before and after the remap, andKytyExceptionHandlerturns any fault it does not recognise into a fatalEXIT.Instrumenting the exception path with
VirtualQueryshowed the state changing underneath two adjacent calls.atis queried beforeprev, yet they disagree about the same range:Both cover
0x10382e6000-0x10382f0000. The range was unmapped when the first query ran and mapped when the second did, so the fault is transient rather than a real invalid access. Logging everyMapBackingfailure produced no hits, confirming nothing failed — the fault falls between the unmap and the remap.Observed in Grand Theft Auto V (PPSA04264) as a reproducible crash while the game streams world data (driving, entering vehicles). With this change the same session completes the first mission with no faults, where previously it aborted every time.
The retry is bounded to 4096 attempts per faulting address, so an address that never becomes valid still reaches the existing fatal path with its diagnostics intact.
Scope and limits
This is a mitigation, not a removal of the race. The complete fix is to make the remap atomic with respect to guest access — either holding guest threads off during the placeholder window, or mapping new backing over the old without an intermediate unmapped state. That is a larger change to the memory manager and is not attempted here.
Validation
AI assistance
AI assistance was used for this change.
@copilot-pull-request-reviewer[bot] on GitHub · 2026-08-31 22:45 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
@chatgpt-codex-connector[bot] on GitHub · 2026-08-31 22:47 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
5d3d046775ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -803,0 +817,4 @@last_vaddr = info->access_violation_vaddr;retries = 0;}if (++retries <= 4096) {@chatgpt-codex-connector[bot] on GitHub · 2026-08-31 22:47 UTC · original
If the same virtual address is transiently faulted during multiple successful remaps, these thread-local retries accumulate because a successful instruction execution never returns here to clear the counter, and the counter is reset only when a different fault address is observed. Consequently, the 4097th otherwise recoverable fault at that address falls through to the fatal path, so long-running workloads that repeatedly remap a hot address can still crash despite every individual remap completing successfully.
Useful? React with 👍 / 👎.
@Nmzik on GitHub · 2026-09-01 20:53 UTC · original
Hack
Pull request closed