Repository navigation
fix(ampr): return EBUSY when a command does not fit and EPERM before a buffer is bound - #7300
Merged
oneandonlydean merged 1 commit intoOct 17, 2026
Conversation
…a buffer is bound
This was referenced Oct 18, 2026
12 tasks done
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The AMPR recording calls (reads, nops, markers and completion writes) returned
0x8002001Cboth when a command did not fit in the bound buffer and when no buffer was bound. On a PS5 they returnSCE_KERNEL_ERROR_EBUSY(0x80020010) when the command does not fit, with the offset and the command count left as they were, andSCE_KERNEL_ERROR_EPERM(0x80020001) when no buffer is bound. The AMM commands in the same file already return these two codes, and ampr_emu does the same.Titles
CONTROL Resonant (PPSA34547, 01.300.300) and Alan Wake 2 (PPSA02572, 01.200.007) read their compiled effects (
/app0/shaders/build/ps5/*.binrfx, 141 and 153 files) through APR command buffers of 0x400 bytes. After each read, their recorder (CONTROL Resonant eboot0x3b41a32,0x3b41a49,0x3b41a78; Alan Wake 20x30711b2,0x30711c9,0x30711f8) compares the result with0x80020010. On that value it submits the buffer, binds a new one and records the read again. Onmain(6005185ee) a 0x400-byte buffer holds 25 reads. The 26th returns0x8002001C, and so does every later read of that batch, so most effects are never read (116 of 141 in CONTROL Resonant). Both titles then stop with SIGSEGV 7 s after start, with nothing in the log. CONTROL Resonant looks upshapeengine.rfx, gets no effect and reads through the null pointer (eboot0x383f2b0).Alternating runs of 40 s (
main, this PR,main, this PR), with onlylibSceAmpr.prxdiffering:mainOne Alan Wake 2 run with this PR was killed by my test script while it cleaned up the run before it, and was repeated.
With this PR, CONTROL Resonant shows its photosensitivity warning, then the Remedy end-user license agreement and privacy policy (they scroll with the right stick and accept with Cross). It then shows the display calibration and First Time Setup. Alan Wake 2 plays the Remedy logo and shows its end-user license agreement. Alan Wake 2's dump has no PlayGo metadata, so it ran with
APS5_PLAYGO_UNLISTED_CHUNKS=installed.Tested
PS5 (FW 13.60): a payload calls the console's
libSceAmpr.sprx(dlopenanddlsym), and the commands are only recorded, never submitted. With 64-, 100- and 1024-byte buffers, these four calls return 0 until the next command does not fit:sceAmprAprCommandBufferReadFilesceAmprCommandBufferNopsceAmprCommandBufferWriteAddressOnCompletionsceAmprCommandBufferPushMarkerThen they return
0x80020010, with the offset and count unchanged. A 1024-byte buffer takes 51 reads of 20 bytes. Constructed but never bound, all four return0x80020001.Payload output (the lines where a call fails, plus the last read that fits in 1024 bytes)
guest_ampr_markers: the full buffer case now also covers a read, a nop and a completion write, and the unbound case covers all of them. WithExport.cppas onmainit fails atGuestAmpr.cpp:254.Linux (Arch, kernel 7.2.9, GCC 16.2.1, Release, AMD Radeon RX 9070 XT with RADV, Mesa 26.2.4): full CTest with
-j8, 1371 of 1372 pass.agc_driver_tessellationsegfaults; it does not loadlibSceAmpr.prx, and none of its sources change here.Windows Server 2025 VM, WinLibs GCC 15.2, Release,
BUILD_TESTING=ON, no GPU: full CTest, no failures out of 1407;agc_driver_gated_dispatch_capture_short_timeoutis skipped there.The tests and runs above are on
main6005185ee. The branch was then rebased ontob4f05ab32without conflicts (none of the 109 new commits touch these files); thereguest_ampr_markers,guest_ampr_threadsandguest_ampr_cpp_errorpass.tools/check_conventions.pypasses.tools/pr_overlap.py: no overlap with open pull requests.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code