fix(relinker): reject x64 instructions longer than 15 bytes #1942
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1942"
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 Zinebyte on 2026-10-09T01:30:19Z.
What
The x64 decoder accepts instructions longer than 15 bytes and can let an overlong MOVNTSS reach Intel conversion. Reject overlong prefix streams and both decoded-length return paths while retaining existing shorter decoding, operand bytes and file-offset diagnostics. The limit follows Intel's SDM, Volume 2A §2.2.1.
Tested
The isolated decoder/converter regression fails against base
f145139676and passes with this patch. The independent reviewer passed 84 integration cases covering 15/16-byte legacy, VEX2/VEX3, EVEX, immediate, displacement, branch and MOVNTSS forms across Linux/Windows output; malformed bytes were not executed. Zorin OS 18.1 x86-64, GCC 13.3.0, Python 3.12 and CMake 3.28.3, relinker-only Release/static, one build job. Author validation of the composed four patches passed all 39 configured CTest registrations in 6.06 s, including progress_report and import_audit; exact-base baseline passed 38/38 in 5.93 s. A separate independent review rebuilt the composed revision and passed 39/39 in 6.03 s. Focused baseline and patched checks use small synthetic inputs. Existing assertions are retained; no real game, firmware, private asset or GPU input was used.Native Windows/macOS runtime, real titles, sanitizers and cold shared-CI timing remain unverified. Existing approximate opcode semantics remain outside this architectural length bound.
Open #1552 adds separate DecoderLengthTests.cpp/DecoderLengthCases.hpp tests and does not change this test file or implement this guard. #1756 adds narrower RDPRU/MCOMMIT matcher-length guards and shares the converter test file. The cross-segment branch fix also adds tests there; the reviewed patches compose. No cross-PR runtime validation is claimed.
Checklist
f145139676; open-work audit found no equivalent implementationImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T02:27:01Z.
Review: APPROVED
Reviewed the complete diff against current main. Prefix scanning stops at the architectural 15-byte limit, and both decoded-length return paths reject instructions that extend past it; the added cases cover exact 15-byte instructions, overlong prefix streams, scanner offsets, and MOVNTSS conversion. This head is based directly on current main. On Linux/GCC 12.2, the full relinker-only build passed, all 38 registered relinker CTests passed, and Conventions plus diff whitespace checks passed. GitHub reports no upstream checks for this head, so this approval records the local evidence only.
Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T11:58:43Z.
Windows run, since the description notes it wasn't tested there: Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build with
BUILD_TESTING=ON.28d2fe49cherry-picked onto currentmaind70b8998(applies cleanly).amd64_only_converterpasses.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-09T17:12:41Z.
Could a maintainer rerun the failed Windows job? At head
28d2fe49, Build attempt 2 reports onlyagc_shader_disk_cachetiming out after 120 seconds;amd64_only_converterpassed. Linux, the Linux/Windows/macOS relinker jobs, and Conventions passed. This account has no upstream Actions rerun permission.Thanks rmz-24 for the Windows validation: Windows 11 Pro 25H2 / MinGW-w64 GCC 15.2, Release, full CTest 510/510 including Windows PE execution, with
28d2fe49cherry-picked ontod70b8998. That is useful separate evidence; the CI timeout's cause remains unproven.AI-assisted review and reply.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:08:22Z.
Closing: an instruction longer than 15 bytes faults on the console, so no title executes one, and nothing here shows a conversion that goes wrong on main because of it. If a title's relink trips over one, please reopen with that title.
Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-09T20:32:11Z.
Understood. The synthetic decoder cases do not demonstrate a title whose conversion fails on main. I have no such title evidence and accept keeping this closed. The earlier CI rerun request is no longer needed for this closed PR.
AI-assisted review and reply.
Pull request closed