fix(relinker): name the second SELF container magic as a SELF input #1317

Merged
Dextroid17 merged 1 commit from upstream-pr/1317 into main 2026-10-08 09:36:29 +00:00
Dextroid17 commented 2026-10-07 23:28:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T23:28:19Z.


What

ElfReader::ReadHeader names 0x1D3D154F as a SELF container. Retail dumps also carry a second container magic, 0xEEF51454 (54 14 f5 ee), and that one fell through to the generic branch:

FAIL: Invalid ELF magic number: 54 14 f5 ee

The message reads as a corrupt input rather than an encrypted one, so the user cannot tell that decryption is the missing step — which is what issues #1033 and #1305 ran into.

Both magics now throw the SELF message.

Measured against two retail dumps:

  • PPSA03671 — eboot.bin and libcohtml.Prospero.prx start with 54 14 f5 ee, so today it reports "Invalid ELF magic number".
  • PPSA28997 — eboot.bin and sce_module/libSceNpCppWebApi.prx start with 4f 15 3d 1d, already named.

Two lines, one new test case, no behaviour change for inputs that are not SELF.

Tested

Linux (CachyOS, GCC, Release, BUILD_TESTING=ON), relinker target rebuilt (3 s).

  • Proved the test bites: reverted only ElfReader.cpp (git stash push -- core/relinker/relinker/src/parsing/ElfReader.cpp), rebuilt, and input_magic fails on the new case with exactly FAIL: Invalid ELF magic number: 54 14 f5 ee. Restored, it passes.
  • ctest -R "input_magic|elf_header|elf_offsets|dynamic_segment|string_table_bounds|guest_needed_modules|guest_module_directories|linux_load_alignment" — 8/8 pass.
  • Not tested with a title (no decrypted eboot is available; every dump here is still SELF).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4779718465 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1317). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-07T23:28:19Z. --- ### What `ElfReader::ReadHeader` names `0x1D3D154F` as a SELF container. Retail dumps also carry a second container magic, `0xEEF51454` (`54 14 f5 ee`), and that one fell through to the generic branch: ``` FAIL: Invalid ELF magic number: 54 14 f5 ee ``` The message reads as a corrupt input rather than an encrypted one, so the user cannot tell that decryption is the missing step — which is what issues #1033 and #1305 ran into. Both magics now throw the SELF message. Measured against two retail dumps: - **PPSA03671** — `eboot.bin` and `libcohtml.Prospero.prx` start with `54 14 f5 ee`, so today it reports "Invalid ELF magic number". - **PPSA28997** — `eboot.bin` and `sce_module/libSceNpCppWebApi.prx` start with `4f 15 3d 1d`, already named. Two lines, one new test case, no behaviour change for inputs that are not SELF. ### Tested Linux (CachyOS, GCC, Release, `BUILD_TESTING=ON`), `relinker` target rebuilt (3 s). - **Proved the test bites:** reverted only `ElfReader.cpp` (`git stash push -- core/relinker/relinker/src/parsing/ElfReader.cpp`), rebuilt, and `input_magic` fails on the new case with exactly `FAIL: Invalid ELF magic number: 54 14 f5 ee`. Restored, it passes. - `ctest -R "input_magic|elf_header|elf_offsets|dynamic_segment|string_table_bounds|guest_needed_modules|guest_module_directories|linux_load_alignment"` — 8/8 pass. - Not tested with a title (no decrypted eboot is available; every dump here is still SELF). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
Dextroid17 commented 2026-10-08 03:10:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T03:10:38Z.


@oneandonlydean ready for eyes — names the second SELF container magic so the relinker reports a SELF rather than Invalid ELF magic number; the test flips when the reader is reverted. Four checks green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051380768 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1317#issuecomment-6051380768). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-08T03:10:38Z. --- @oneandonlydean ready for eyes — names the second SELF container magic so the relinker reports a SELF rather than Invalid ELF magic number; the test flips when the reader is reverted. Four checks green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1317
No description provided.