Skip to content

fix(libSceAgcDriver): safely probe the output pointer in sceAgcDriverGetCoredumpMode - #20406

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/agcdriver-probe-coredump-mode
Nov 27, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
milescoviello:fix/agcdriver-probe-coredump-mode

Conversation

@milescoviello

@milescoviello milescoviello commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

sceAgcDriverGetCoredumpMode stored the mode with *mode = 0, so a non-null pointer to unmapped memory faulted the host. It now writes through GuestCopyOut_nid_no_patch and returns 0x8A6D0003 (DRIVER_NULL_OUTPUT, its existing null-pointer error) when the write fails, with errno left as the caller had it. The reported mode is still always 0.

The debt entry records the unmapped-memory result as a host-safety fallback; what the console does there is not measured.

Tested

Linux (Ubuntu 26.04.1), GCC 15.2, Release.

  • guest_agc_driver_debug_unavailable gains a case: the unmapped pointer 0x10 returns 0x8A6D0003 and leaves errno unchanged; the null and valid-pointer cases still pass.
  • ctest -R '^guest_agc_driver_debug_unavailable$': passes. No GPU is used by this test or this path.
  • tools/check_conventions.py passes on the branch and this body.
  • kiwe147's batch run of 38dff7a9ad, applied with other PRs onto main fd4aeed483 (one combined tree, not this PR alone), Windows 11, WinLibs GCC 15.2.0 r7, Release, no validation layer: guest_agc_driver_debug_unavailable pass on an NVIDIA GeForce RTX 3080 (driver 621.24).

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…GetCoredumpMode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malekaifa

Copy link
Copy Markdown
Contributor

I independently reproduced and verified this at head 5790cff7b178054be73729bc61d40a88e11c1e30 on exact current main fdff305890ea7cddd38f7ab8876c163cbdbf88d2.

Machine: Windows 10.0.26200, NVIDIA GeForce RTX 5080, NVIDIA 621.14, Vulkan validation 1.4.363.

I first applied only the PR's GuestAgcDriverDebugUnavailable.cpp regression to main. With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, and ANYPS5_GPU="RTX 5080":

ctest --test-dir build -R '^(guest_agc_driver_debug_unavailable|agc_driver_bda_device)$' -V

The negative control fails as expected: guest_agc_driver_debug_unavailable terminates with Windows access violation 0xc0000005 on the unmapped 0x10 output pointer; agc_driver_bda_device passes.

I then applied the PR's Unimplemented.cpp and debt hunks to the same tree and reran the identical command. Both tests pass. The loader inserts VK_LAYER_KHRONOS_validation 1.4.363, the RTX 5080 is selected, and neither run contains was not found but was requested or any VUID- line.

@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the review supports merging, and the reported targeted test and convention check were not run in this review.

What I ran

Reviewed head 38dff7a9ada9155be04d202381a7e60d73df9cd0 against the prepared diff. Read the complete changed files in files/ and the guest copy helper implementation. No commands or tests were run.

Results

Check Result Note
Diff and changed code passed Three changed files read
Targeted test not run Result supplied in PR description
Convention check not run Result supplied in PR description

Findings

Blocking

None.

Non-blocking

None.

Not verified

Physical console behavior for unmapped pointers is explicitly unmeasured. No build, test, or convention check was run here. Read: core/libs/prx/libSceAgcDriver/Unimplemented.cpp, core/libs/tests/GuestAgcDriverDebugUnavailable.cpp, docs/dev/debt/changes/fix-agcdriver-probe-coredump-mode.md, and core/libs/prx/libc/src/General.cpp (lines 850–885). All three files listed as reviewed in the manifest were read; files.json was not present in the review folder listing.

To get this to a good state

Nothing is required.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 38dff7a9ad, applied with git apply on main fd4aeed483 together with the other 27 PRs of one batch (#11049, #20072, #22100, #22892, #23774, #24199, #24495, #15314, #21180, #21221, #21486, #22597, #22839, #22895, #23550, #24672, #14573, #16873, #17113, #17879, #19183, #20057, #22066, #22219, #22781, #22958, #24478). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_agc_driver_debug_unavailable (1 test, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6522 tests) on the RTX 3080 has 8 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked, agc_storage_write_back_host_retile. Traced to other PRs of the batch, each by reverting it and testing again: #21486 (agc_driver_graphics, agc_graphics_profile_draw), #24672 (guest_kernel_sys_neo_mode); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_indexed_draw. The 2125 agc_/video tests on the iGPU have 5 failing: agc_driver_graphics, agc_driver_stencil_plane_memory, agc_driver_store_over_untracked, agc_graphics_profile_draw, agc_storage_write_back_host_retile (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @kiwe147 for including this one in the batch. The guest_agc_driver_debug_unavailable test passing is a useful Windows data point, and I added it to the description, noted as a combined batch tree rather than this PR alone.

@malekaifa malekaifa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 38dff7a9ada9155be04d202381a7e60d73df9cd0. The change replaces the unsafe direct guest write with GuestCopyOut_nid_no_patch, preserves caller errno, keeps the existing null/error result, and adds an unmapped-output regression. Current main still contains the direct *mode = 0 write, and the repository already uses the same saved-errno guest-copy pattern in other output paths. I found no blocking issue in the three-file patch. I did not independently rerun the reported Linux/Windows tests in this review. AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit 6e251ed into boykopovar:main Nov 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants