fix(agc): report guest addresses above the user address space as unmapped on Windows #5479

Merged
ymatrix1 merged 1 commit from upstream-pr/5479 into main 2026-10-14 06:16:16 +00:00
ymatrix1 commented 2026-10-13 20:52:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ymatrix1 on 2026-10-13T20:52:34Z.


What

A title can hand the GPU a buffer or descriptor V# based at an address above the Windows user-mode address space. Kena: Bridge of Spirits (PPSA01746) bases a read-only V# at 0xf00000000000. VirtualQuery fails for any address above lpMaximumApplicationAddress, so describePages returned "not queried" and the driver aborted with AGC driver: cannot query guest memory, although nothing can ever be mapped there and the shader never dereferences it.

On Windows, treat a range above the user address limit as unmapped (the Linux procmap_query / /proc/self/maps path already reports an uncovered range that way) instead of failing the query. The limit is read once from GetSystemInfo.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release. agc_driver_graphics_tests passes with the change; without it the new assertion fails with AGC driver: cannot query guest memory. The test covers GuestMemory::Accessible and CommittedRanges on addresses above the user address space.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA01746 (one of several crashes)
  • GPUs tested: NVIDIA GeForce RTX 4070 SUPER (615-class driver), Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4849331059 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5479). Originally posted by [ymatrix1](https://github.com/ymatrix1) on 2026-10-13T20:52:34Z. --- ### What A title can hand the GPU a buffer or descriptor V# based at an address above the Windows user-mode address space. Kena: Bridge of Spirits (PPSA01746) bases a read-only V# at `0xf00000000000`. `VirtualQuery` fails for any address above `lpMaximumApplicationAddress`, so `describePages` returned "not queried" and the driver aborted with `AGC driver: cannot query guest memory`, although nothing can ever be mapped there and the shader never dereferences it. On Windows, treat a range above the user address limit as unmapped (the Linux `procmap_query` / `/proc/self/maps` path already reports an uncovered range that way) instead of failing the query. The limit is read once from `GetSystemInfo`. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Release. `agc_driver_graphics_tests` passes with the change; without it the new assertion fails with `AGC driver: cannot query guest memory`. The test covers `GuestMemory::Accessible` and `CommittedRanges` on addresses above the user address space. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA01746 (one of several crashes) - [x] GPUs tested: NVIDIA GeForce RTX 4070 SUPER (615-class driver), Windows 11 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-13 20:53:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:53:20Z.


The conventions check is red. I could not retrieve its job log, but the diff contains new explanatory code comments in GuestMemory.cpp and LiveStack.cpp; this repository only permits code comments that document technical debt. The PR body also has no ### Checklist section, which the conventions check requires. Please remove or document the comments under the debt rules, add the required checklist section, and rerun conventions. The Windows behavior and regression test themselves look narrowly scoped from this diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154980505 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5479#issuecomment-6154980505). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:53:20Z. --- The conventions check is red. I could not retrieve its job log, but the diff contains new explanatory code comments in `GuestMemory.cpp` and `LiveStack.cpp`; this repository only permits code comments that document technical debt. The PR body also has no `### Checklist` section, which the conventions check requires. Please remove or document the comments under the debt rules, add the required checklist section, and rerun conventions. The Windows behavior and regression test themselves look narrowly scoped from this diff.
MarcZX10 commented 2026-10-13 20:58:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:58:10Z.


The updated head removes the explanatory comments and adds the checklist, and the latest conventions run passes. Thanks for addressing those findings. The Windows test report is still from your earlier validation; I did not rerun the Windows test locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155061829 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5479#issuecomment-6155061829). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:58:10Z. --- The updated head removes the explanatory comments and adds the checklist, and the latest conventions run passes. Thanks for addressing those findings. The Windows test report is still from your earlier validation; I did not rerun the Windows test locally.
ymatrix1 commented 2026-10-13 20:58:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ymatrix1 on 2026-10-13T20:58:15Z.


Fixed both: removed the explanatory comments from GuestMemory.cpp and LiveStack.cpp (the cause and the 0xf00000000000 V# context now live in the commit message), and added the ### Checklist section to the PR body. Conventions is green now. The behavior and the regression test are unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155063312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5479#issuecomment-6155063312). Originally posted by [ymatrix1](https://github.com/ymatrix1) on 2026-10-13T20:58:15Z. --- Fixed both: removed the explanatory comments from `GuestMemory.cpp` and `LiveStack.cpp` (the cause and the `0xf00000000000` V# context now live in the commit message), and added the `### Checklist` section to the PR body. Conventions is green now. The behavior and the regression test are unchanged.
xXPBSXx commented 2026-10-14 03:05:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T03:05:49Z.


Title evidence for this PR (Windows 10, NVIDIA GeForce RTX 4080 SUPER, one run each, no picture checked): Kena: Bridge of Spirits (PPSA01746). On plain main a 300 s run of ours stopped after about 187 s with terminate called after throwing an instance of 'std::runtime_error' / what(): AGC driver: cannot query guest memory, which is the failure this PR describes. With this PR (head aec5ba133, main 2ba3147ac) that abort did not occur in one run; the title then stopped after about 84 s on a different error (image descriptor is incompatible with the static runtime image interface, a 3D T# read as a 2D array, see #5555). Not checked: the rendered picture, a control run on exactly the same main without this PR, other titles.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159961659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5479#issuecomment-6159961659). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-14T03:05:49Z. --- Title evidence for this PR (Windows 10, NVIDIA GeForce RTX 4080 SUPER, one run each, no picture checked): Kena: Bridge of Spirits (PPSA01746). On plain `main` a 300 s run of ours stopped after about 187 s with `terminate called after throwing an instance of 'std::runtime_error'` / `what(): AGC driver: cannot query guest memory`, which is the failure this PR describes. With this PR (head `aec5ba133`, `main` `2ba3147ac`) that abort did not occur in one run; the title then stopped after about 84 s on a different error (`image descriptor is incompatible with the static runtime image interface`, a 3D T# read as a 2D array, see #5555). Not checked: the rendered picture, a control run on exactly the same `main` without this PR, other titles. AI-assisted (Claude Code).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!5479
No description provided.