Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T13:06:15Z.
What
Since #6678, GTA V (PPSA04264) crashes in the open world on Windows, in every run. The cause is the red zone damage of #361: a fault that AnyPS5 resumes in guest code can overwrite
[rsp-0x80, rsp-0x10). Deferred settles return small imports to the write watch, and the guest's own stores into that memory then fault and get resumed. #7473 adds more resumed faults of the same kind on resident runs.At eboot
0x28aaa50, the game's zlibinflate_fastreloads two pointers from its red zone (mov -0x78(%rsp),%r9,mov -0x70(%rsp),%rbx) and then reads throughrdx, which holds a small garbage value. The same code crashed this way before #637/#5596.Measured
Every fault the vectored handler resumes was logged, with its rip, data address and
VirtualQuerytype (a diagnostic patch inReportCrash, not proposed). The game resumes a story save in Los Santos. Windows 11 26200, RTX 4090 (NVIDIA 616.92), i9-13900K, WinLibs GCC 15.2.0 r7, Release, write watch on.0x28aa…/0x28ab…)main47a266cf9(10-17)a84027dcb(merge before #6678)755fecb33(#6678 merge)mainf6ce8e34a(10-20)MEM_MAPPED4 KiB subpages of 16 KiB viewsmain275e89679(10-21)MEM_PRIVATE512 KiB resident runs (eboot0x28abdd4)main7280a17ec+APS5_NO_DEFERRED_SETTLES=1MEM_MAPPED, 44MEM_PRIVATE)The first two rows and the #6678 row come from a first-parent
git bisect runwhose step counts the resumed faults over 60 s of Story: "bad" means at least one. The plain crash bisect was too slow and too random to use. The merge before #6678 had 0 faults; #6678 had 134.rewatchSettledImportsputs settled imports under 1 MiB back in the write watch. GTA's buffers are resident direct memory when they are imported, andMEM_MAPPED16 KiB views when the stores fault. So they become shared views after they return to the watch, and from then on each guest store into them is armed and resumed.MEM_PRIVATEat rewatch time. That changed nothing: the memory is still private at that point.resumeResidentWritesarms resident runs that have been proven clean. The 44 to 89MEM_PRIVATEfaults per run come from it, and 16 to 75 of them land in zlib.MEM_MAPPEDfaults (eboot0x162b9e4,0x28f413a) remain with deferred settles off.main47a266cf9had none, so at least one more merge between 10-17 and 10-21 arms memory this title writes. I have not bisected that one yet.Question
Every new arming of guest-written memory brings #361 back on Windows. A few options, from narrowest to most general:
@EagleBearerYS @Dripl1x, since this is your code: which direction would you take? I can test any branch on GTA within the hour: the fault log patch gives a deterministic count per run.
AI-assisted: yes (Claude Code). Measured on the machine above.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T13:10:48Z.
@tibzejoker, thank you for the bisect and the per-run fault counts; that makes this much easier to pin down. #6678 is mine. I'm reading
rewatchSettledImportsagainst your table now, together with my open #8926, which also returns retired small imports to the write watch, so it needs the same check before it goes anywhere. I'll post a branch here for you to run on Grand Theft Auto V (PPSA04264), with what we'd like counted.Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T13:11:31Z.
Thanks @EagleBearerYS. I'll run your branch on GTA V as soon as it's up, with the same per-run fault counts and types. A first-parent bisect of the 85
MEM_MAPPEDfaults left withAPS5_NO_DEFERRED_SETTLES=1is running now. I'll post which merge it lands on here.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-21T13:34:30Z.
@tibzejoker, thanks. #7473 is mine, and for it I'd take option 2: stop arming resident runs.
armResidentmakes clean resident runs (MEM_PRIVATE, 256 KiB and up) read-only so that a collect can skipGetWriteWatch, and the first guest store into each run is then resumed on the guest thread. That is the #361 fault that #5596 removed. It happens at most once per run per mapping, which fits your 44 to 89 per run. Option 3 would not cover it, since these are private pages, not shared views.There is no runtime switch for it. I'll post a branch here that removes the arming, so resident memory is collected with
GetWriteWatchonly, as before #7473. Expected on your counter: 0MEM_PRIVATEfaults per run,MEM_MAPPEDunchanged. #7471 stays as it is.If your bisect of the remaining 85
MEM_MAPPEDfaults lands on #7473 or on my #8857, I'll take that too.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-21T13:53:35Z.
@tibzejoker, the branch:
Dripl1x/AnyPS5fix/no-resident-write-faults, one commitd6e270ea9fon main80565c5942.armResidentandresumeResidentWrites: resident runs are never write-protected and are collected withGetWriteWatchonly.HostImportAccessstays and is now a no-op on resident pages, soView::hostImportsis only counted, never read.CheckLargeResidentWritesStopFaultingis nowCheckLargeResidentWritesDoNotFault: a 2 MiB resident mapping staysPAGE_READWRITEafter collects, and 16 write/collect rounds over every page raise no access violation. With main'sWindowsMappings.hppit fails at the first protection check (GuestMemory.cpp:1773: after two clean collects the run is armed read-only).guest_memoryandguest_mmap_fixed_anonymous3/3;agc_driver_host_import_windows,agc_driver_host_import_at_map,agc_driver_host_import_teardown,agc_driver_host_import_failure_handlesandagc_host_import_retire3/3;agc_host_import_sparseskipped itself (exit 77);agc_resident_present,agc_host_import_unmap,agc_host_import_retirement,agc_host_import_second_mapping,agc_parked_import_unmap,agc_sparse_run_import,agc_sparse_run_import_copied,agc_driver_host_import_lifetimeandagc_driver_host_import_mutation_race1/1. No title was run on this branch. The change is Windows-only.What I'd expect on your counter: 0
MEM_PRIVATEresumed faults per run. The cleanest comparison is yourAPS5_NO_DEFERRED_SETTLES=1row: 133 (85MEM_MAPPED, 44MEM_PRIVATE) should become 85 and 0. With deferred settles on, the #6678 faults remain until @EagleBearerYS's branch.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T13:57:45Z.
@tibzejoker thank you again: the bisect and the per-type fault counts are what pinned this down.
What #6678 does, in the code. When a small import's deferred settle completes,
rewatchSettledImportsputs its range back in the write watch (GuestMemory::Rewatch). At that point Grand Theft Auto V (PPSA04264)'s buffers are still resident direct memory: private pages tracked withGetWriteWatch, which take no fault. That's why your MEM_PRIVATE check at rewatch time changed nothing. Later, a second mapping of the same direct memory turns the run into 16 KiB shared views (WindowsMappings::demote). From then on, every clearing collect over the range makes all its aliases read-only, so each guest store faults and is resumed, with #361's damage to the red zone. Before #6678, the import kept the range out of the write watch for good, so it was compared and never armed.My open #8926 (retired imports back in the write watch) calls the same
Rewatch, so it can do the same, and it would also bring such ranges back withAPS5_NO_DEFERRED_SETTLES=1. It stays on hold until it has this fix as well.The branch:
EagleBearerYS/AnyPS5@fix/agc-rewatched-imports-compared-when-shared(d98ee15162, two commits onmain27bcd6a29e). It's your option 1, applied where the memory turns shared:Rewatchmarks the pages of each range it puts back in the watch.GetWriteWatch, as #6678 intended.windows_write_watchgains a case, and the newagc_rewatched_direct_sharedmaps direct memory, rewatches a block of it as a settle does, then maps the same memory a second time. The block must not be armed, a store into it must not fault, and the store must show through both mappings.How it fits with #7473: @Dripl1x's
fix/no-resident-write-faults(d6e270ea9f) is the resident side, so resident runs are no longer armed. This branch only covers memory that turns shared after a rewatch, so the two don't overlap, and they merge cleanly. Your table suggests both are needed to reach zero.Could you run these four, with your fault-log patch, the same save and at least 60 s of Story?
main;main+ this branch;main+ this branch withAPS5_NO_DEFERRED_SETTLES=1;main+ this branch + Dripl1x's.Please post the fault counts by type (MEM_MAPPED, MEM_PRIVATE) and how many land in zlib, as in your table.
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T14:07:25Z.
The bisect of the remaining
MEM_MAPPEDfaults lands on #8172 (@wachi35676, "keep resident DCC targets watched under aligned block imports", merged9df34d08).Same counter as above, with
APS5_NO_DEFERRED_SETTLES=1so that #6678 is out of the picture. Each row counts theMEM_MAPPEDresumed faults over 60 s of Story:MEM_MAPPEDresumed faultse9cc4a8ef(merge before #8172)d9df34d08(#8172 merge)28f126650(#6598 merge, ~80 merges later)28f126650with #8172 reverted (git revert -m 1 d9df34d08, clean)So #8172 accounts for these faults on its own; the single fault in the last row is the background level we have always seen. My reading of the change: an aligned block import now keeps the resident parts of its run in the write watch instead of unwatching the whole run. When the game then maps that memory at a second address, the run moves into the section and becomes shared views. Those views are tracked by write protection, so the guest's own stores fault (eboot
0x162b9e4,0x28f413a, outside zlib in this window, but the same #361 hazard). Before #8172 the whole run left the watch, so the views were never armed.#8172 fixes a real test failure (#8103,
agc_driver_msaa_dcc_clear_4), so reverting it is not the answer. One option is to keep watching only the parts that stay private (resident,MEM_WRITE_WATCH), and drop them from the watch at the moment they become shared views. I'll test whatever branch you prefer.@Dripl1x: your
fix/no-resident-write-faults(d6e270ea9) is reviewed here and queued. I'll run it as soon as this machine is free and post the counts.AI-assisted: yes (Claude Code). Measured on the machine in the first post.
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T14:21:00Z.
@Dripl1x,
fix/no-resident-write-faults(d6e270ea9, on main80565c594) on GTA V: 0MEM_PRIVATEresumed faults, as you expected. One run of 150 s of Story each, same counter and machine as above:MEM_MAPPEDMEM_PRIVATEAPS5_NO_DEFERRED_SETTLES=1Two follow-ups to my earlier posts:
MEM_MAPPEDfaults that I attributed to #8172 are gone on your branch with deferred settles off, even though80565c594contains #8172. On28f126650, reverting #8172 did take the count from 134 to 1. So on newer trees, what #8172 exposed seems to go through the resident-run arming that your branch removes. @wachi35676, there may be nothing left to do on your side. I'll re-check on the next main.AI-assisted: yes (Claude Code). Measured on the machine in the first post.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T14:26:27Z.
@tibzejoker thanks, those two rows settle it. With Dripl1x's
d6e270ea9f, the MEM_PRIVATE faults and the ones you'd pinned on #8172 are gone, so what's left with deferred settles on is #6678's path. That's what #9159 (d98ee15162) targets, so we've left the branch as it was.Could you run one more, the same way as your second row (150 s of Story, deferred settles on, the default)?
main+ Dripl1x'sd6e270ea9f+ #9159 atd98ee15162.We expect the 394 MEM_MAPPED faults from settled imports in that row to go, and the zlib ones with them.
If you have time for a second run,
main+ #9159 alone (without Dripl1x's fix) would show the two fixes apart.Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T14:39:51Z.
@EagleBearerYS, both runs, on
main663de1ab2, 150 s of Story with deferred settles on (the default). Same counter and machine as above:MEM_MAPPEDMEM_PRIVATEmain+ #9159 alone (98adb5f20,d98ee1516)main+ Dripl1x'sd6e270ea9+ #9159MEM_MAPPEDresumed fault. The 111 left are #7473's resident arming; 45 of them land at zlib's eboot0x28abdd4, and the run crashed.MEM_MAPPEDfaults come back. None of them is in zlib. Their sites are eboot0x28f413a(18),0x162b9e4(10), and two in a system DLL (+0x…426910,+0x…42214). Those are the same sites as the 85 I first saw with deferred settles off, which #7473's arming seemed to hide.comparedWhenShared, and their views get armed.MEM_PRIVATEfault in the combined row is at0x28abdd4. It is probably the race path inHandleWrite, where the page was already writable when the handler ran.One run per row. These counts are stable in kind from run to run, but not in exact number.
AI-assisted: yes (Claude Code). Measured on the machine in the first post.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T14:48:10Z.
@tibzejoker thank you, that pair is exactly what was missing. Your reading fits: the 42 MEM_MAPPED faults at
0x28f413aand0x162b9e4are on resident runs that an import kept in the write watch. That's the path #8172 changed so that resident DCC targets stay watched, which #8103 needs. Those runs are never rewatched, so #9159's first two commits don't mark them.The third commit covers them.
EagleBearerYS/AnyPS5@fix/agc-imports-compared-when-sharedis at 79cae21875, one commit on top of #9159'sd98ee15162, and #9159 takes it next:ImportWatchedmarks the resident pages of each run it keeps in the watch.Could you run one more, the same way (150 s of Story, deferred settles on)?
main+ Dripl1x'sd6e270ea9f+ 79cae21875.We expect MEM_MAPPED at your background level. The single MEM_PRIVATE fault in your last run is on the resident side, so it's yours and Dripl1x's to judge.
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-21T14:55:26Z.
@EagleBearerYS, a run on
main663de1ab2+ Dripl1x'sd6e270ea9+ your branch, 150 s of Story with deferred settles on. Your branch head is now81aec5834(withead292e2eunder it, on top ofd98ee1516), not 79cae21875, so I ran that head.MEM_MAPPEDMEM_PRIVATEmain+d6e270ea9+ #9159 (d98ee1516)main+d6e270ea9+ your branch (81aec5834)0x162b9e4is gone too.MEM_MAPPED:0x28f413a(71 faults): amov %rax,(%rsi,%rdi,8)inside a loop that keeps state inr12–r14, so it is not a red-zone leaf at that point.+0x…4269(34 faults): host code, which does not use a red zone.From my side, the crash is fixed with the two fixes together. Whether to widen the rule to direct memory that was never imported, so that the remaining sites stop faulting too, is your and the maintainers' call. That is the most general form of #361, and I'll test it if you go that way.
AI-assisted: yes (Claude Code). Measured on the machine in the first post.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T15:00:41Z.
@tibzejoker thank you for the run and the whole bisect: 0 MEM_PRIVATE, 0 faults in zlib, and no crash is the result we were after.
Grand Theft Auto V (PPSA04264)'s crash needs both fixes:
d6e270ea9f, for the resident runs that #7473 armed;81aec58343, the branch you ran (it goes onto #9159 once its checks finish), for memory that turns shared after a settle puts it back in the write watch, or while an import keeps it watched.The 105 MEM_MAPPED that remain (
0x28f413a, and the system DLL's host code) we're leaving as they are for now. By your reading they're direct memory that was never imported and is mapped twice. That memory is armed, as it was before any of these changes. Per your notes, neither site reloads pointers from a red zone, so they don't carry #361's crash. Comparing all such memory instead of arming it would cost every title that maps direct memory twice: its collects would return nothing, so GPU caches over it would compare on every use, and address-based builds would copy it. We'd widen the rule only for a title that crashes at a site of that kind.@Dripl1x, are you opening a PR for
d6e270ea9f? Then it and #9159 can name each other as the two halves of #9136.Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-22T01:35:05Z.
@EagleBearerYS yes, it's #9181 (the same commit
d6e270ea9f, unchanged). Its description names #9159 as theMEM_MAPPEDhalf of #9136, so #9159 can point to #9181 instead of the branch.Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-22T10:17:54Z.
Data point from Windows 11 Pro, i9-14900K, RTX 5080 (NVIDIA 32.0.16.1742), WinLibs GCC 15.2.0 Release, GTA V 01.005.000, warm caches, default settings.
On
main7e2ba73e4, GTA V first stops earlier, atsceVoiceSetThreadsParams(fe4016f61made its mode 1 throw; fix in #9730). With that fix, the crash in this issue shows up already in the North Yankton prologue, 1.5-2 minutes into gameplay, on the same thread but at a different site:eboot
0x285514bis the game'sint $0x41assert right afterinflate(strm, Z_SYNC_FLUSH)(0x28aad40, the same zlib asinflate_fastat0x28aaa50) returned -3 (Z_DATA_ERROR). My guess, not measured: the inflate state is damaged the same way and is caught as a data error beforeinflate_fastreads through it.Alternating runs, same scripted pad input, 600-900 s each:
main7e2ba73e4+ voice fixd6e270ea9) + #9159 (99aeb0ac5)I didn't count resumed faults (no fault-log patch on this machine), so this only confirms that the two PRs together remove the crash on a second machine and GPU.