fix(relinker): ignore unused guest note payloads #2088

Closed
authurtabo-byte wants to merge 1 commit from upstream-pr/2088 into main
authurtabo-byte commented 2026-10-09 07:45:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-09T07:45:20Z.


What

Ignore unused guest note payloads when reading an ELF. A non-loadable PT_NOTE or SHT_NOTE range can extend beyond the file without preventing conversion; ranges that contribute loaded data remain checked. This fixes conversion of 3D MiniGolf (PPSA03647) without weakening loadable-segment bounds checks.

Tested

Rebased onto main f8c2f072. Subsequent main commits only change PR-intake workflows; the tested runtime/relinker source is unchanged. Windows, MinGW-w64 GCC 15.2.0, Release, relinker-only build: 41/41 CTest tests pass. tools/check_conventions.py --base origin/main passes. The run competed with a separate build; tls_function_coverage took 40.32 seconds, and the suite took 43.18 seconds.

The regression covers out-of-file segment and section notes, while malformed loadable ranges still fail. MGXAe independently tested the previous revision on Windows against main d70b8998: 41/41 passed; restoring main's GuestImageReader made guest_note_segments fail with ELF range exceeds file: offset=0xb00, size=0x18, fileSize=0xa00.

Linux and macOS were not rerun locally.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source: none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes, Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4797607707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2088). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-09T07:45:20Z. --- ### What Ignore unused guest note payloads when reading an ELF. A non-loadable PT_NOTE or SHT_NOTE range can extend beyond the file without preventing conversion; ranges that contribute loaded data remain checked. This fixes conversion of 3D MiniGolf (PPSA03647) without weakening loadable-segment bounds checks. ### Tested Rebased onto main `f8c2f072`. Subsequent main commits only change PR-intake workflows; the tested runtime/relinker source is unchanged. Windows, MinGW-w64 GCC 15.2.0, Release, relinker-only build: 41/41 CTest tests pass. `tools/check_conventions.py --base origin/main` passes. The run competed with a separate build; `tls_function_coverage` took 40.32 seconds, and the suite took 43.18 seconds. The regression covers out-of-file segment and section notes, while malformed loadable ranges still fail. MGXAe independently tested the previous revision on Windows against main `d70b8998`: 41/41 passed; restoring main's GuestImageReader made `guest_note_segments` fail with `ELF range exceeds file: offset=0xb00, size=0x18, fileSize=0xa00`. Linux and macOS were not rerun locally. ### Checklist - [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 - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source: none added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes, Codex
MGXAe commented 2026-10-09 13:17:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MGXAe on 2026-10-09T13:17:26Z.


Tested on native Windows 11 (MinGW-w64 GCC 15.2.0, WinLibs r7): relinker-only Release build of this branch (9dd37ec5) merged with current main (d70b8998), 41/41 ctest pass.

With main's GuestImageReader.cpp swapped in, guest_note_segments fails (ELF range exceeds file: offset=0xb00, size=0x18, fileSize=0xa00); with this change it passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081665116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2088#issuecomment-6081665116). Originally posted by [MGXAe](https://github.com/MGXAe) on 2026-10-09T13:17:26Z. --- Tested on native Windows 11 (MinGW-w64 GCC 15.2.0, WinLibs r7): relinker-only Release build of this branch (`9dd37ec5`) merged with current `main` (`d70b8998`), 41/41 ctest pass. With `main`'s `GuestImageReader.cpp` swapped in, `guest_note_segments` fails (`ELF range exceeds file: offset=0xb00, size=0x18, fileSize=0xa00`); with this change it passes.
authurtabo-byte commented 2026-10-09 20:31:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-09T20:31:09Z.


Thanks @MGXAe for confirming the reproduction on main and running the CTest suite on native Windows MinGW. Verified all 41 relinker tests passing locally as well.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088756292 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2088#issuecomment-6088756292). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-09T20:31:09Z. --- Thanks @MGXAe for confirming the reproduction on main and running the CTest suite on native Windows MinGW. Verified all 41 relinker tests passing locally as well.
github-actions[bot] commented 2026-10-09 22:07:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:07:27Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#1506 core/relinker/CMakeLists.txt L235
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090056225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2088#issuecomment-6090056225). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T22:07:27Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1506 | `core/relinker/CMakeLists.txt` [L235](https://github.com/boykopovar/AnyPS5/blob/c2ac5dd93f0b6275634fe57415681f27af95ae7d/core/relinker/CMakeLists.txt#L235) | | |

Pull request closed

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!2088
No description provided.