kernel: retry a fault on memory our own map says is committed #534
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!534
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/534/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-09-09 07:29 UTC · original
CheesyPoofs346:kernel-transient-map-fault-retry→main· +38 −0 · 4 files · 1 commits · closed without mergingProblem. Remapping guest direct memory is not atomic.
MapBackingandUnmapBackinggo through Windows placeholders, so the pages are briefly absent, and a guest thread touching them in that window takes an access violation on memory that is committed both before and after the remap. This was observed directly: twoVirtualQuerycalls one line apart disagreed about the same range, reportingMEM_RESERVEand thenMEM_COMMIT. The exception handler treated it as a fatal access violation and aborted.Change. When the fault address is reported as committed by this emulator's own guest map, retry the faulting instruction instead of aborting. The retry is bounded to 4096 attempts per address, so an address that is genuinely bad still fails rather than spinning, and it sits behind
--no-retry-transient-map-faultsfor anyone who would rather see the abort.Effect. GTA V previously crashed reproducibly while streaming during the first mission; with this it completed that mission with zero faults. No performance change; performance was not measured.
Limitations, and why this is a draft.
MapBacking/UnmapBackingatomic, or serialising guest access against the remap, and treat this as a stopgap.Verification. Builds clean. Exercised by the GTA V run described above; the diagnosis rests on the contradictory
VirtualQuerypair, which is direct evidence of the window rather than an inference from the crash alone.References
Microsoft Windows API,
VirtualAlloc2/MapViewOfFile3placeholder semantics: splitting or replacing a placeholder mapping unmaps the region before the new view is mapped, leaving the address range temporarily inaccessible to other threads.Pull request closed