graphics: qualify a GPU page fault on the faulting byte #422
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!422
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/422/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 11:03 UTC · original
CheesyPoofs346:fix/gpu-fault-mapping-boundary→main· +5 −2 · 1 files · 1 commits · closed without mergingSummary
Problem
GpuResourceManager::HandleFaultdecides whether a fault belongs to the GPU tracker like this:A page fault reports a single address, but
IsMappedis asked whether eight bytes starting at that address are mapped, and it requires the whole span to be contained in one range:When the faulting address lies within eight bytes of the end of a mapping, the span runs past that end,
IsMappedreturns false, andHandleFaultdeclines. The caller inruntimeLinker.cppthen treats the fault as unrecognised and callsEXIT, so the emulator aborts on a page the tracker had itself write-protected.Observed in Grand Theft Auto V (PPSA04264) as a recurring crash while the game streams world data. Instrumenting the exception path with
VirtualQuerygave:The faulting page is committed and
PAGE_READONLY— write-protected by the tracker — so this is a fault the handler was meant to service.0x151387fffa + 8 = 0x1513880002crosses the mapping's end at0x1513880000, so the eight-byte test fails. Every crash address collected over several sessions sat within eight bytes of a mapping boundary.After the change the write-protected-page crash no longer occurs; a separate, unrelated fault in that title now surfaces later with a different signature (
MEM_RESERVE,protect=0), which I am still investigating and which is not addressed here.Nothing else is altered: the widening to eight bytes is kept wherever the mapping actually extends that far, so the invalidation range is unchanged in the common case.
AI assistance
AI assistance was used for this change.
@copilot-pull-request-reviewer[bot] on GitHub · 2026-08-31 11:06 UTC · original · reviewed
Pull request overview
This PR adjusts GPU page-fault qualification in
GpuResourceManager::HandleFaultto avoid incorrectly rejecting faults that occur near the end of a mapped range, preventing fatal “unrecognized” faults that abort the emulator.Changes:
💡 Add a
code-reviewagent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.@ -17,2 +18,4 @@const uint64_t fault_size = IsMapped(fault_vaddr, 8) ? 8 : 1;if (!IsMapped(fault_vaddr, 1)) {return false;}@Copilot on GitHub · 2026-08-31 11:06 UTC · original
The new comment says to qualify on the faulting byte and then widen only as far as the mapping allows, but the implementation computes the 8-byte window check first and only ever chooses 8 or 1. This also does two separate RangeSet lookups/locks in a fault path. Consider computing the maximum contiguous mapped span starting at fault_vaddr (up to 8) under a single shared_lock, and returning false if the span is 0.
Pull request closed