Repository navigation
fix(libSceAgcDriver): read the RELEASE_MEM interrupt select only from RELEASE_MEM packets - #1587
Conversation
… RELEASE_MEM packets Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Linux results, since this was tested on Windows only. Everything passes here. Nobara 44 (Linux 7.2), GCC 16.2.1, Release,
The CPU failure is |
Dextroid17
left a comment
There was a problem hiding this comment.
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 onto d70b8998; only PacketMemory.cpp swapped between arms:
main this PR
agc_driver_tests exit 134 exit 0
agc_driver_pm4_tests exit 134 exit 0
On main the abort is span:288 ... operator[] inside Driver::preparePacketMemory (PacketMemory.cpp:21); the gdb frame reads packet=std::span of length 2, header=0xC0004200, opcode=0x42 — the 2-dword PFP_SYNC_ME packet (Pm4.cpp:335 size(2)). 0x49 is size(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_driver failures in issue #2321 (its #331 guest_ajm is a separate AT9 issue).
Could not verify: Windows.
Written with AI assistance.
|
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
Bisecting with that build gives b25c6cc (the merge of #1362) as the first bad commit; its parent d026063 passes. |
|
Checked the diff (the interrupt select is now read only for |
…mem-int-sel-bounds fix(libSceAgcDriver): read the RELEASE_MEM interrupt select only from RELEASE_MEM packets
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 at 0596a7a), 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).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