Relinker fails during binary conversion: Dynamic segment out of bounds (offset 0x10298) #2663
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LightStorm72 on 2026-10-10T10:23:51Z.
Title: Relinker fails during binary conversion: Dynamic segment out of bounds (offset 0x10298)
Description
A game conversion that was working completely fine yesterday on an earlier build is now failing on the latest
maincommit. When runningrelinker, the process halts immediately with a dynamic segment out of bounds error (offset 0x10298).When attempting to run
relinkeragainst the decrypted main executable for **Dreaming Sarah /PPSA02929 ** on Windows 11, the conversion pipeline halts immediately with a segment parsing error (Dynamic segment out of bounds).The Relinker correctly detects the platform, directories, and processes NID references (815 total), but fails when attempting to parse the ELF's
PT_DYNAMICsection header offset at0x10298.Since the exact same ELF file converted successfully on previous builds, this appears to be a recent regression introduced in the Relinker binary parsing logic.
Steps to Reproduce
Environment & Specifications
Title: Dreaming Sarah PPSA02929
OS: Windows 11 64-bit
CPU: AMD Ryzen 5 3600 (6-Core / 12-Thread)
GPU: NVIDIA GeForce RTX 2070 SUPER
RAM: 32 GB DDR4 @ 3200 MHz
AnyPS5 Build: Latest main (Compiled via MinGW-w64)
Console Output
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T10:28:26Z.
Thanks for the detailed reproduction. The reported offset points to the
PT_DYNAMICfile offset, but the failure is raised when the relinker checks whether the complete[p_offset, p_offset + p_filesz)range fits inside the ELF file. The offset by itself does not show whetherp_fileszis unexpectedly large, the file differs between runs, or the parser is seeing an unusual segment layout.Could you share these details from the same decrypted
eboot.elf(no need to upload the game binary)?llvm-readelf -h -lW -d eboot.elforreadelf -h -lW -d eboot.elf, especially thePT_DYNAMICandPT_LOADentries.That should let us check the bounds against the ELF's declared program headers and identify whether a recent parser change caused the regression.
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T10:33:51Z.
@MarcZX100 Here you go and thanks for reply, I'm trying my best to help too! the successful build was deleted and replaced with the latest build. but the I have the game that was succesfully Converted with the app.exe, running about 20fps and ingame about 9fps too.
Console Output
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T10:37:38Z.
Thanks, this narrows it down. The
PT_DYNAMICshown foreboot.binis within the file:PT_DYNAMIC p_offset0x770790PT_DYNAMIC p_filesz0x6e00x770e70eboot.binsize0x771fa80x10298So this
PT_DYNAMICrange fits in thiseboot.bin, and its offset does not match the offset in the failure. That suggests the relinker may be receiving a different ELF than the one inspected, or the failing run used another path/build.Could you paste the exact command line used for the failing run and confirm the input path passed to
relinker.exe? Please runGet-FileHash -Algorithm SHA256and report the file size for that exact input path (it is fine to redact user-specific directories). If the input is this sameeboot.bin, please confirm that explicitly. The failing AnyPS5 commit isbe403084; the earlier successful commit is still unknown, so any commit/hash from a working run would also help establish whether this is a regression.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T10:38:41Z.
Thanks for confirming the older working build is no longer available. I checked the code history as another discriminator: the files that read the executable's program headers and
PT_DYNAMIC(ElfReader.cppandRelinkerPipeline.cpp) have no changes between failing commitbe403084and currentmaina29ef592.For the exact
eboot.binhash you provided, the displayedPT_DYNAMICrange is valid, but the reported failure offset is different. With the previous build gone, the useful next check is to rerun this same hashed input with a relinker built from currentmainand include the exact command line/input path from that run. If it still reports0x10298, please also include the complete error output (including anyInput:line) andreadelf -lWoutput from that exact input path. That will confirm whether the file being inspected is the file the relinker receives.Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T10:46:38Z.
@MarcZX100 Is this all you need? I'm trying my best.
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T10:56:04Z.
@MarcZX100
Additional Context on Older Build Behavior
I can confirm that this exact
eboot.binfile was successfully converted by the Relinker on an earlier build of AnyPS5 before the recent commits.Looking at the
readelfdata:Start of program headers:64 (PT_LOAD and PT_DYNAMIC entries fit within the 7.8 MB file)Start of section headers:36299856 (Section headers point past EOF)It appears earlier versions of
relinkeronly parsed the Program Headers and ignored the out-of-bounds section header table (e_shoff), allowing the conversion to complete. The strict bounds validation in recent builds is now flagginge_shoff/ section header tables pointing beyond physical EOF.Would it be possible to add a fallback or tolerance check in
ElfReaderfor binaries where Program Headers are valid but Section Headers are truncated/missing?Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T11:35:49Z.
@MarcZX100
when I use --skip-sce-module it Ran Perfectly and Generated the exe file, tried it in the old converted game and it Ran too ( Same 20fps to 10fps in game)
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T11:49:40Z.
@MarcZX100
Update: Found the exact file matching the failing offset
I investigated further and found that the error offset
0x10298matches thePT_DYNAMICsegment ofsce_sys/about/right.sprx, not the maineboot.bin.File details
sce_sys/about/right.sprx66,196bytes (0x10294)78874D144EE7FB1EF6B664210E2DB0507CFF162988DC6D16D8635EBB2E219831Relevant
readelf -h -lW -doutput:readelfreports these errors:The file ends at offset
0x10294, but itsPT_DYNAMICsegment starts at0x10298and declares a size of0x1B0. Therefore, the segment starts 4 bytes past EOF and extends 436 bytes beyond EOF.By comparison, the main
eboot.binhas aPT_DYNAMICoffset of0x770790, and its declared dynamic segment fits within that file.This appears to explain why the relinker reports
Dynamic segment out of bounds (offset 0x10298).Could you confirm whether the relinker is expected to process
sce_sys/about/right.sprxduring this conversion? I'm not sure whether this file is intentionally structured this way or whether it is incomplete, but the matching offset seems significant.Thanks for helping me investigate this!
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:03:59Z.
Correction to my previous path analysis: I had missed the current recursive module-identity scan, so my conclusion that
right.sprxcould not be read was wrong.The executable's direct
DT_NEEDEDlist still does not nameright.sprx, but when a needed module is unresolved,GuestModuleBuilderwalks the title tree and callsGuestImageReader::ReadModuleNameson each ELF.prx,.sprx, and.suprxcandidate before it knows whether that file provides a requested identity. That reader parsesPT_DYNAMIC; the out-of-bounds range inright.sprxtherefore aborts this discovery pass even if the file would not ultimately be selected. This matches the reported failure with module processing enabled and success with--skip-sce-module.The current check is still correctly rejecting an invalid dynamic range. The likely issue is that recursive discovery scans unrelated title assets such as
sce_sys/about/right.sprx. Open PR #2708 proposes limiting discovery to a configured module parent, which appears to address this path; its current relinker matrix still has failures, so that fix is not yet validated. The exact command is still useful to confirm which input root and module layout triggered the scan.Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T12:17:07Z.
@MarcZX100
Thanks for the detailed explanation! I'm glad my testing helped narrow down the issue and contributed to the investigation. I'll keep an eye on PR #2708 and would be happy to help with further testing if needed. It's great to be able to contribute to the project and help the team move toward a solution.
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-10T12:18:17Z.
Reproduced without the title on
main197ffac9(macOS host, relinker-only build):DT_NEEDEDnames a library the title does not bundle, plussce_sys/about/right.sprxwhosePT_DYNAMICstarts 4 bytes past the end of the file:FAIL: Dynamic segment out of bounds (offset 0xa04), exit 2, for Linux and Windows output.right.sprx, or with--skip-sce-module: converts.sce_sys/about/right.sprxadded:FAIL: Dynamic segment out of bounds (offset 0x145f48)for Linux, Windows and--macosoutput.An executable that needs any library the title does not bundle reaches the identity scan, so a dump whose
right.sprxis cut short stops there.Two ways out, both checked with the same cases:
f756225f) removes both tree walks. The synthetic case converts for Linux and Windows output. Its five failing tests are the ones @MarcZX100 listed.DavidSamir:fix/relinker-module-search-skips-sce-sys(3d831a99, one commit onmain197ffac9) keeps the walks and leavessce_sysbeside the executable out of them: it holds package metadata, not title modules. A candidate elsewhere whose module names cannot be read is still an error, and that error now names the file (Input: <path>), which this report did not have.Whichever direction is taken, the new cases in
test_guest_module_identity.pyon that branch cover this report.Tested (the branch in 2)
guest_module_identity.mainwith this issue's message. Removing each of the three changes in turn fails a different new case.main's for Linux, Windows and--macosoutput, and identical again with the truncatedright.sprxadded.tools/check_conventions.py --base origin/main: passed.Not tested: Dreaming Sarah itself, and a Linux or Windows host. The Windows cases check the conversion, not a run.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:25:55Z.
Validation of the narrow
sce_sysexclusion on currentmainI applied DavidSamir's commit
3d831a99oncf8b129eand compared its synthetic regression with a clean current-main relinker:sce_sys/about/right.sprxwith truncatedPT_DYNAMICon unchangedmainDynamic segment out of boundssce_sysexclusiongit diff --checkLightStorm72 independently tested the same commit on Windows 11 with MinGW-w64 GCC 15.2.0: the relinker built, CTest passed 93/93, conversion of the original Dreaming Sarah files completed without the
right.sprxerror, and the converted game launched. The reported frame rate was similar to the prior working conversion; no performance improvement is claimed.This change excludes
sce_sysfrom the fallback walks and leaves discovery in other paths, includingMedia/Modules,prx, and nested module directories, intact. That is a smaller behavioral change than the current #2708 head, which changes module discovery to adjacent directories and updates tests that previously covered those layouts. The current #2708 CI run is still in progress, so this comparison is based on its current diff and the completed tests above.The local Linux run was on
cf8b129e; the independent Windows run was on commit3d831a99based onb5f5362d. Neither replaces the project's official upstream Build workflow or a macOS-host run.Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-10T12:30:13Z.
@MarcZX100 thank you for the Linux run.
@LightStorm72 you offered to test. The one thing still missing is your dump: if you can, build the relinker from this branch and rerun your command without
--skip-sce-module.Expected: the conversion finishes and
right.sprxis not mentioned. Only the relinker changes, so the libraries you already built stay as they are.To go back afterwards:
cd C:\AnyPS5,git checkout main,cmake --build build --target relinker.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T12:30:30Z.
Windows 11 testing results — commit
3d831a99I tested @DavidSamir's
fix/relinker-module-search-skips-sce-sysbranch on Windows 11.Environment
[3d831a99](https://github.com/DavidSamir/AnyPS5/commit/3d831a99)Results
sce_sys/about/right.sprx.Dynamic segment out of boundserror no longer occurs.Runtime performance
The game performs about the same as it did before, so I haven't observed a performance improvement from this change. However, the original conversion issue appears to be resolved, and the game still runs.
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T12:33:37Z.
@DavidSamir
this is the full Powershell Commands too
Imported from boykopovar/AnyPS5. Originally posted by LightStorm72 on 2026-10-10T13:17:14Z.
Tested now with latest build and It ran on 60fps now
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T13:22:56Z.
Regression coverage on current
mainThe issue reporter has confirmed that the current build converts and runs Dreaming Sarah. The relinker fix is already on
main; this branch adds coverage for the malformed-metadata path that previously surfaced in the report.I refreshed the test onto upstream
main(5edae353). The fork branch iscodex/fix-relinker-sce-sys-scan-2663-latest, at8e02e489e.guest_needed_modulestools/check_conventions.py --base upstream/maingit diff --check upstream/main...HEADThe added fixture gives a
PT_DYNAMICsegment an out-of-file offset undersce_sys/about/right.sprx. The guest-module scan ignores that malformed metadata file, and conversion succeeds in both Linux and Windows output modes. This is synthetic coverage; the reporter’s title conversion/runtime result is separate evidence.I found no open PR for this test. I have not opened one because the intake workflow still requires 20 merged PRs; my live merged count is 15. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T18:08:40Z.
Closing: since #2708 the relinker no longer searches the title tree for modules, so
sce_sys/about/right.sprxis not read any more, and the conversion works on current main as confirmed above.