fix(relinker): ignore unwind records that cover no code #6619

Merged
Get-fix merged 1 commit from upstream-pr/6619 into main 2026-10-19 07:59:14 +00:00
Get-fix commented 2026-10-15 23:13:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T23:13:29Z.


What

An FDE whose address range is 0 describes no instructions, and an unwinder never matches a pc in it. The exception-table reader rejected one, which stopped the conversion of Limbo (CUSA01664) on main 5d9dcc42d:

FAIL: Strict filter: inconsistent FDE function range (offset 0x3f4ffc)

One of Limbo's 17328 FDEs covers 0 bytes at 0x47dd0, where the next record starts. Such a record is now read and validated as before, but left out of the function list. A record whose start differs from the .eh_frame_hdr entry, or whose range overflows, is still rejected. Part of the PS4 work tracked in #3093.

Tested

Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, on main 5d9dcc42d:

  • unwind_record_bounds has a new case: the fixture's FDE with a range of 0 reads as no functions. Each of these makes it fail: rejecting the record as before, and keeping it as an empty function.
  • This branch alone, with CI's relinker-only configuration (-DANYPS5_RELINKER_ONLY=ON): 177 of 177 tests pass. The relinker it builds gets Limbo past this record to its inline jump tables, which #6618 handles; with both, Limbo converts.
  • Full ctest with my open pull requests: 1305 of 1308 pass; see #6618 for the three that do not.
  • tools/check_conventions.py passes.

Not tested on Linux or macOS hosts.

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 under Silent stubs in their library's technical debt file
  • 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
  • Unblocks: conversion of CUSA01664 (Limbo) with #6618, #3093
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4881054683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6619). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T23:13:29Z. --- ### What An FDE whose address range is 0 describes no instructions, and an unwinder never matches a pc in it. The exception-table reader rejected one, which stopped the conversion of Limbo (CUSA01664) on `main` `5d9dcc42d`: ``` FAIL: Strict filter: inconsistent FDE function range (offset 0x3f4ffc) ``` One of Limbo's 17328 FDEs covers 0 bytes at 0x47dd0, where the next record starts. Such a record is now read and validated as before, but left out of the function list. A record whose start differs from the `.eh_frame_hdr` entry, or whose range overflows, is still rejected. Part of the PS4 work tracked in #3093. ### Tested Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, on `main` `5d9dcc42d`: - `unwind_record_bounds` has a new case: the fixture's FDE with a range of 0 reads as no functions. Each of these makes it fail: rejecting the record as before, and keeping it as an empty function. - This branch alone, with CI's relinker-only configuration (`-DANYPS5_RELINKER_ONLY=ON`): 177 of 177 tests pass. The relinker it builds gets Limbo past this record to its inline jump tables, which #6618 handles; with both, Limbo converts. - Full ctest with my open pull requests: 1305 of 1308 pass; see #6618 for the three that do not. - `tools/check_conventions.py` passes. Not tested on Linux or macOS hosts. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Unblocks: conversion of CUSA01664 (Limbo) with #6618, #3093 - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
simonbbby commented 2026-10-16 02:27:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-16T02:27:12Z.


Independent Linux and native macOS parser coverage for exact head a9fa0e8b088432e6a7ba7182390a41ff31648550, filling the host gap in the description.

  • Ubuntu 24.04 / GCC 13.3 / x86-64, and macOS 27.2 / Apple clang 21 / arm64.
  • Compiled the unchanged UnwindRecordBoundsTests.cpp, EhFrameReader.cpp and BufferUtils.cpp, using the include directories of unwind_record_bounds_tests. The stock test reports 14 cases passed on both hosts. Substituting only EhFrameReader.cpp from HEAD^ fails on both with Strict filter: inconsistent FDE function range.
  • An external probe reuses Fixture() and sets the FDE range at offset 112 to zero while retaining eight existing malformed CIE/FDE/segment cases, plus a mismatched .eh_frame_hdr start. All nine malformed zero-length cases remain rejected on both hosts.
  • Both the stock test and external probe also pass with AddressSanitizer + UndefinedBehaviorSanitizer on both hosts, with no diagnostics.

One small extra regression is worth keeping: a zero-sized FDE whose start disagrees with its header entry. In a scratch production copy, returning an empty region immediately after reading size == 0 still passes all 14 stock cases, but the external probe catches this malformed record on both hosts. Current PR code correctly rejects it. The case is:

auto bytes = Fixture();
Io::WriteU64(bytes, 112, 0);
Io::WriteU64(bytes, 16, 0x2001);
bool rejected = false;
try { Relinker::UnusedNidFilter::ReadExceptionFunctions(bytes, {load, eh}, {}, {}); }
catch (const std::exception&) { rejected = true; }
Require(rejected);

No repository source changed. Scope: the production exception-table reader and synthetic byte fixtures; no full relinker/CTest build, Limbo conversion, guest execution or Rosetta run. The existing Windows title-conversion evidence remains the title evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6206665522 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6619#issuecomment-6206665522). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-16T02:27:12Z. --- Independent **Linux and native macOS parser coverage** for exact head `a9fa0e8b088432e6a7ba7182390a41ff31648550`, filling the host gap in the description. - Ubuntu 24.04 / GCC 13.3 / x86-64, and macOS 27.2 / Apple clang 21 / arm64. - Compiled the unchanged `UnwindRecordBoundsTests.cpp`, `EhFrameReader.cpp` and `BufferUtils.cpp`, using the include directories of `unwind_record_bounds_tests`. The stock test reports **14 cases passed** on both hosts. Substituting only `EhFrameReader.cpp` from `HEAD^` fails on both with `Strict filter: inconsistent FDE function range`. - An external probe reuses `Fixture()` and sets the FDE range at offset 112 to zero while retaining eight existing malformed CIE/FDE/segment cases, plus a mismatched `.eh_frame_hdr` start. All **nine malformed zero-length cases remain rejected** on both hosts. - Both the stock test and external probe also pass with **AddressSanitizer + UndefinedBehaviorSanitizer** on both hosts, with no diagnostics. One small extra regression is worth keeping: a zero-sized FDE whose start disagrees with its header entry. In a scratch production copy, returning an empty region immediately after reading `size == 0` still passes all 14 stock cases, but the external probe catches this malformed record on both hosts. Current PR code correctly rejects it. The case is: ```cpp auto bytes = Fixture(); Io::WriteU64(bytes, 112, 0); Io::WriteU64(bytes, 16, 0x2001); bool rejected = false; try { Relinker::UnusedNidFilter::ReadExceptionFunctions(bytes, {load, eh}, {}, {}); } catch (const std::exception&) { rejected = true; } Require(rejected); ``` No repository source changed. Scope: the production exception-table reader and synthetic byte fixtures; no full relinker/CTest build, Limbo conversion, guest execution or Rosetta run. The existing Windows title-conversion evidence remains the title evidence.
savvaniss commented 2026-10-18 20:59:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-18T20:59:43Z.


Second-title data point: Hasbro Family Fun Pack (CUSA03312, my own dump) needs this PR, on Linux and Windows.

Relinker-only Release build, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7. Starting from main f3059421f, I merged, in this order: #7660, #6619 (a9fa0e8b0), #5138 (5f5641732), #6381 (6f8d9a09d), 3b158c1e4 from #6977, #6354 (81561867f), #6357 (32fe3aa8b), #6684 (ab9d21afc) and #6618 (bf06a8e5c). With that stack, the Linux and --windows conversions of the eboot and its 9 bundled modules complete. I then rebuilt the relinker once per member with only that member left out. Without this PR, both targets stop in the eboot:

FAIL: Strict filter: inconsistent FDE function range (offset 0xd42390)

The other members each stop at their own step, so every one of them is needed for this title; the whole table is on #6977.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6255078855 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6619#issuecomment-6255078855). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-18T20:59:43Z. --- Second-title data point: Hasbro Family Fun Pack (CUSA03312, my own dump) needs this PR, on Linux and Windows. Relinker-only Release build, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7. Starting from `main` `f3059421f`, I merged, in this order: #7660, #6619 (`a9fa0e8b0`), #5138 (`5f5641732`), #6381 (`6f8d9a09d`), 3b158c1e4 from #6977, #6354 (`81561867f`), #6357 (`32fe3aa8b`), #6684 (`ab9d21afc`) and #6618 (`bf06a8e5c`). With that stack, the Linux and `--windows` conversions of the eboot and its 9 bundled modules complete. I then rebuilt the relinker once per member with only that member left out. Without this PR, both targets stop in the eboot: ``` FAIL: Strict filter: inconsistent FDE function range (offset 0xd42390) ``` The other members each stop at their own step, so every one of them is needed for this title; the whole table is on #6977. AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-19 08:00:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T08:00:18Z.


Checked: a zero-range FDE is still read and validated (start vs .eh_frame_hdr, overflow) and only dropped from the function list; the new case in unwind_record_bounds pins it and fails without the change. Relinker CI green on Linux, macOS and Windows, plus the independent Linux/macOS and Hasbro runs in the thread. Merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262522445 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6619#issuecomment-6262522445). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T08:00:18Z. --- Checked: a zero-range FDE is still read and validated (start vs `.eh_frame_hdr`, overflow) and only dropped from the function list; the new case in `unwind_record_bounds` pins it and fails without the change. Relinker CI green on Linux, macOS and Windows, plus the independent Linux/macOS and Hasbro runs in the thread. Merged.
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!6619
No description provided.