fix(libSceAgcDriver): read the RELEASE_MEM interrupt select only from RELEASE_MEM packets #1587
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1587"
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 kr4y4 on 2026-10-08T13:49:39Z.
What
Driver::preparePacketMemoryreadspacket[2], theRELEASE_MEMinterrupt select, for every packet. The read used to sit behindopcode == 0x49 &&, and #1362 moved it ahead of that check.packetis the packet's own span, andPm4::Validateaccepts 2-dword packets, for examplePFP_SYNC_ME(case 0x42: size(2)). So for those, index 2 is one past the end:0x49, so the result is unaffected, but the read is out of bounds._GLIBCXX_ASSERTIONS, thestd::spanbounds check aborts on the first such packet.The interrupt select is now read only for
RELEASE_MEM, whose packetValidaterequires to be 8 dwords.Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7.
-D_GLIBCXX_ASSERTIONS -fsanitize=undefined -fsanitize-trap=undefined(main at0596a7a2), NVIDIA RTX 4070 Laptop:agc_driverandagc_driver_pm4exit with 0xC0000409:span:302: ... std::span<const unsigned int>::operator[] ... Assertion '__idx < size()' failed, fromDriver::preparePacketMemoryon aPFP_SYNC_MEpacket (header0xc0004200, size 2).033a4636(rebased on63c57d22without changes to this file):agc_driverandagc_driver_pm4pass with--repeat until-fail:3on the RTX 4070 and on an Intel Raptor Lake-S iGPU.Checklist
main; no other open PR implements the same thing🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-09T04:22:26Z.
Linux results, since this was tested on Windows only. Everything passes here.
Nobara 44 (Linux 7.2), GCC 16.2.1, Release,
BUILD_TESTING=ON. This PR merged ontomain29e533ac.main29e533acmain+ this PRctest -R agc_driver -j1-E agc_driver)The CPU failure is
guest_dynamic_loader, which fails the same way onmain.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-09T15:53:00Z.
Review: COMMENTED
Linux negative control — the Linux result above is a Release run, which passes either way and so does not exercise the read.
Debug +
-D_GLIBCXX_ASSERTIONS, gcc 16.2.1, merged ontod70b8998; onlyPacketMemory.cppswapped between arms:On main the abort is
span:288 ... operator[]insideDriver::preparePacketMemory(PacketMemory.cpp:21); the gdb frame readspacket=std::span of length 2, header=0xC0004200, opcode=0x42— the 2-dwordPFP_SYNC_MEpacket (Pm4.cpp:335 size(2)).0x49issize(8)(Pm4.cpp:412), so the guarded read is in bounds whenever the value is used. Release arm with the change: both tests pass.This also closes the two
agc_driverfailures in issue #2321 (its #331guest_ajmis a separate AT9 issue).Could not verify: Windows.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-09T19:41:04Z.
Independent confirmation on AMD, from a duplicate I opened by mistake (#2338, closed). Windows 11 (26300), Radeon 860M (RDNA 3.5), WinLibs GCC 15.2.0 r7, clean build with
-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-D_GLIBCXX_ASSERTIONS:agc_driveragc_driver_pm4maind70b8998std::span::operator[]assertion inDriver::preparePacketMemorymain+ this changeBisecting with that build gives
b25c6cce(the merge of #1362) as the first bad commit; its parentd026063apasses.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T01:12:19Z.
Checked the diff (the interrupt select is now read only for
RELEASE_MEM, whichValidaterequires to be 8 dwords, so the 2-dwordPFP_SYNC_MEno longer indexes past its span), build + ctest of libSceAgcDriver (270/270) and CI. The negative control and the Linux/Windows runs from @Dextroid17, @fisherjoey and @LeandroLP23 confirm it. Merging.