fix(relinker): skip the data of Mono AOT images in the syscall scan and code analysis #8198
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8198"
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 ntamas94 on 2026-10-20T02:17:56Z.
What
Unity's Mono AOT images keep their tables, the info word of each PLT entry and their strings in the executable segment. Only the module's own C functions have FDEs, so the relinker scanned the whole segment as code. Gang Beasts (CUSA04865)
Media/Modules/MonoAssembliesPS4.prx(78 images,mono_aot_version67) stopped three times on data:Forbidden syscall instruction at code offset 0x129f1c: insideclass_name_table.0f 07) decoded assysret.Code analysis: overlapping instruction boundaries: in the string area of the last image.MonoAotDataRangesreads each image's staticglobalstable: name and address pairs held in RELATIVE relocations, ended by a NULL name. In each image, code ismethods..methods_end, the 6-bytejmp *rel32(%rip)of each 10-byte PLT entry,X..X_ptrampolines, andspecific_trampolines/static_rgctx_trampolines/imt_thunksup to the next listed address. Everything else frommethodsto the end of the image's last string is data.0x90in their scan copy, as is already done for relative jump tables. The output bytes are unchanged.mono_aot_file_infobut lacksmethods,methods_end,pltorplt_end, an unterminated table, a global without a relocated value, a PLT whose size is not a whole number of 10-byte entries or whose entry is notjmp *rel32(%rip), overlapping code ranges and overlapping images all throw.The format details were read from the module itself (findings in discussion #7941). The 78 image blocks tile the segment from 0xf0 to 0x2ddf2f8 with no gap or overlap, and all 79,477 PLT entries have the 10-byte form. The debt entry records what is not covered: newer Mono AOT formats that bound code with
jit_code_start/jit_code_end, and trampoline arrays bounded by the next listed address instead of their counts.Tested
Windows 11 Pro (26200), WinLibs GCC 15.2.0 r7, on
mainat6bd669e40: the newmono_aot_rangestest passes, and 118 of the 120 relinker tests pass.windows_trace_importsandwindows_import_modulesfail on this machine because Windows Defender quarantines a DLL they generate (WinError 225), with or without this change.Gang Beasts (CUSA04865, 01.00, own dump): with this change on top of #6684, #7660 and the TLS relocation fix from #6977, the executable and all 18 modules convert, including
MonoAssembliesPS4.prx. The executable segment of the convertedMonoAssembliesPS4.prxis byte-identical to the input. Converted this way and run on #6977 with local changes, the title plays a full round (#7941).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
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T02:23:07Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/relinker/relinker/src/pipeline/RelinkerPipeline.cppL328-329core/relinker/relinker/src/guest/GuestModuleBuilder.cppL351-352docs/dev/debt/relinker.mdL4core/relinker/relinker/src/guest/GuestModuleBuilder.cppL1-2, L346, L351-352core/relinker/relinker/src/guest/GuestModuleBuilder.cppL351-352Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/relinker/CMakeLists.txtdocs/dev/debt/relinker.mdcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/relinker/src/analysis/CodeInstructionCollector.cppcore/relinker/relinker/src/pipeline/RelinkerPipeline.cppcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/relinker/src/analysis/CodeInstructionCollector.cppcore/relinker/relinker/src/guest/GuestModuleBuilder.cppcore/relinker/relinker/src/pipeline/RelinkerPipeline.cppdocs/dev/debt/relinker.mdcore/relinker/CMakeLists.txtdocs/dev/debt/relinker.mddocs/dev/debt/relinker.mdImported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-20T02:40:01Z.
Closing: #8166 converts the same module without a Mono-specific reader. Tested on Gang Beasts'
MonoAssembliesPS4.prx; details in https://github.com/boykopovar/AnyPS5/pull/8166#issuecomment-6282062362Pull request closed