fix(relinker): reject overflowing ELF segment address ranges #19470

Open
sumoondev wants to merge 2 commits from upstream-pr/19470 into main
sumoondev commented 2026-11-13 11:22:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sumoondev on 2026-11-13T11:22:16Z.


What

Add virtual address range overflow validation to ElfReader::ReadProgramHeaders().

  • Reject PT_LOAD segments when MappedAddress + MemorySize would overflow uint64_t.
  • Validate uncovered PT_SCE_RELRO ranges before converting them into PT_LOAD segments.
  • Add regression tests for overflowing ranges and the valid UINT64_MAX boundary.
  • Update existing translation boundary fixtures to use valid, non-overflowing memory ranges.

Tested

  • OS: Bazzite Linux (Fedora-based).
  • Build: elf_reader_bounds_tests — passed.
  • CTest: elf_reader_bounds — passed (96 cases).
  • CTest: linux_load_alignment — passed.
  • CTest: linux_load_bounds — passed.
  • CTest: sce_relro — passed.
  • Convention check: python3 tools/check_conventions.py --base origin/main — passed.
  • Full test suite: not run.

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when reading ELF files with virtual-memory ranges near the address limit. Ranges that exceed the supported address space are now rejected, while valid ranges ending exactly at the limit continue to be accepted. This helps prevent malformed segment definitions from being processed as valid.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5294582982 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470). Originally posted by [sumoondev](https://github.com/sumoondev) on 2026-11-13T11:22:16Z. --- ### What Add virtual address range overflow validation to `ElfReader::ReadProgramHeaders()`. - Reject `PT_LOAD` segments when `MappedAddress + MemorySize` would overflow `uint64_t`. - Validate uncovered `PT_SCE_RELRO` ranges before converting them into `PT_LOAD` segments. - Add regression tests for overflowing ranges and the valid `UINT64_MAX` boundary. - Update existing translation boundary fixtures to use valid, non-overflowing memory ranges. ### Tested - OS: Bazzite Linux (Fedora-based). - Build: `elf_reader_bounds_tests` — passed. - CTest: `elf_reader_bounds` — passed (96 cases). - CTest: `linux_load_alignment` — passed. - CTest: `linux_load_bounds` — passed. - CTest: `sce_relro` — passed. - Convention check: `python3 tools/check_conventions.py --base origin/main` — passed. - Full test suite: not run. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md)](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)](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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved reliability when reading ELF files with virtual-memory ranges near the address limit. Ranges that exceed the supported address space are now rejected, while valid ranges ending exactly at the limit continue to be accepted. This helps prevent malformed segment definitions from being processed as valid. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
PrivacyOnion commented 2026-11-13 18:18:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T18:18:48Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against cf182bc96d:

  • Conventions: tools/check_conventions.py failed; git diff --check clean.
    (pull request): error: [commit-subject] Commit subject is not Conventional Commits: cf182bc96d Validate ELF segment address range overflow
    (pull request): error: [pr-title] Pull request title is not Conventional Commits: Validate ELF segment address range overflow
    2 findings, 2 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: elf_reader_bounds_tests built cleanly.
  • CTest (elf_reader_bounds):
    1/1 Test #4966: elf_reader_bounds ................   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/relinker/relinker/src/parsing/ElfReader.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4966: elf_reader_bounds ................***Failed    0.01 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified in core/relinker/relinker/src/parsing/ElfReader.cpp (ElfReader::ReadProgramHeaders) that the arithmetic check ph.MemorySize > std::numeric_limits<std::uint64_t>::max() - ph.MappedAddress correctly detects virtual address overflow for PT_LOAD segments without triggering unsigned underflow or wrapping.
    • Verified in core/relinker/relinker/src/parsing/ElfReader.cpp (ElfReader::ReadProgramHeaders) that uncovered PT_OS_RELRO segments validate virtual address range overflow before conversion to synthetic PT_LOAD segments, throwing RelinkerException with message "PT_SCE_RELRO address range overflow" and FailureOffset matching relro.MappedAddress.
    • Verified that covered PT_OS_RELRO segments are structurally bounded by their enclosing PT_LOAD segment's validated address range, ensuring they cannot cause address range overflow before being tagged as PT_GNU_RELRO.
    • Verified cross-platform 64-bit integer consistency (Linux LP64 and Windows LLP64) using std::uint64_t with std::numeric_limitsstd::uint64_t::max() from , avoiding any narrowing conversions or signed overflow undefined behavior.
    • Verified strict AGENTS.md compliance across core/relinker/relinker/src/parsing/ElfReader.cpp and core/relinker/relinker/tests/ElfReaderBoundsTests.cpp, confirming zero comments added to code, no hardcoded title IDs, and no unauthorized files added.
    • Verified test coverage in core/relinker/relinker/tests/ElfReaderBoundsTests.cpp, confirming valid UINT64_MAX boundary handling, overflow rejection for PT_LOAD and PT_SCE_RELRO, and translation fixtures adjusted to non-overflowing ranges.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5895973071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-5895973071). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-13T18:18:48Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `cf182bc96d`: - **Conventions**: `tools/check_conventions.py` failed; `git diff --check` clean. ``` (pull request): error: [commit-subject] Commit subject is not Conventional Commits: cf182bc96d Validate ELF segment address range overflow (pull request): error: [pr-title] Pull request title is not Conventional Commits: Validate ELF segment address range overflow 2 findings, 2 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `elf_reader_bounds_tests` built cleanly. - **CTest** (`elf_reader_bounds`): ``` 1/1 Test #4966: elf_reader_bounds ................ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/relinker/relinker/src/parsing/ElfReader.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4966: elf_reader_bounds ................***Failed 0.01 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified in core/relinker/relinker/src/parsing/ElfReader.cpp (ElfReader::ReadProgramHeaders) that the arithmetic check `ph.MemorySize > std::numeric_limits<std::uint64_t>::max() - ph.MappedAddress` correctly detects virtual address overflow for PT_LOAD segments without triggering unsigned underflow or wrapping. - Verified in core/relinker/relinker/src/parsing/ElfReader.cpp (ElfReader::ReadProgramHeaders) that uncovered PT_OS_RELRO segments validate virtual address range overflow before conversion to synthetic PT_LOAD segments, throwing RelinkerException with message "PT_SCE_RELRO address range overflow" and FailureOffset matching relro.MappedAddress. - Verified that covered PT_OS_RELRO segments are structurally bounded by their enclosing PT_LOAD segment's validated address range, ensuring they cannot cause address range overflow before being tagged as PT_GNU_RELRO. - Verified cross-platform 64-bit integer consistency (Linux LP64 and Windows LLP64) using std::uint64_t with std::numeric_limits<std::uint64_t>::max() from <limits>, avoiding any narrowing conversions or signed overflow undefined behavior. - Verified strict AGENTS.md compliance across core/relinker/relinker/src/parsing/ElfReader.cpp and core/relinker/relinker/tests/ElfReaderBoundsTests.cpp, confirming zero comments added to code, no hardcoded title IDs, and no unauthorized files added. - Verified test coverage in core/relinker/relinker/tests/ElfReaderBoundsTests.cpp, confirming valid UINT64_MAX boundary handling, overflow rejection for PT_LOAD and PT_SCE_RELRO, and translation fixtures adjusted to non-overflowing ranges. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
sumoondev commented 2026-11-14 04:37:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sumoondev on 2026-11-14T04:37:11Z.

Review: COMMENTED


Thanks for the review. I've updated both the commit subject and PR title to follow Conventional Commits.

I've also reviewed the overlapping PRs. The relevant changes concern alignment validation, while this PR addresses virtual-address range overflow. They are separate checks, and this PR does not depend on those PRs (Depends on: none).

Please let me know if any further changes are needed.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5901665122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-5901665122). Originally posted by [sumoondev](https://github.com/sumoondev) on 2026-11-14T04:37:11Z. **Review:** COMMENTED --- Thanks for the review. I've updated both the commit subject and PR title to follow Conventional Commits. I've also reviewed the overlapping PRs. The relevant changes concern alignment validation, while this PR addresses virtual-address range overflow. They are separate checks, and this PR does not depend on those PRs (`Depends on: none`). Please let me know if any further changes are needed. AI-assisted: yes
PrivacyOnion commented 2026-11-15 20:24:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:24:08Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 72b88e2852:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: elf_reader_bounds_tests built cleanly.
  • CTest (elf_reader_bounds):
    1/1 Test #4966: elf_reader_bounds ................   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/relinker/relinker/src/parsing/ElfReader.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4966: elf_reader_bounds ................***Failed    0.00 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that PT_LOAD virtual address range overflow is checked using ph.MemorySize > std::numeric_limitsstd::uint64_t::max() - ph.MappedAddress, safely preventing unsigned integer overflow.
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that uncovered PT_SCE_RELRO segments undergo address range overflow validation before conversion into synthetic PT_LOAD segments, whereas covered PT_SCE_RELRO segments are already bounded by their validated parent PT_LOAD segments.
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified exception types and arguments, ensuring RelinkerException is thrown with the exact expected error messages ('PT_LOAD address range overflow' and 'PT_SCE_RELRO address range overflow') and FailureOffset set to MappedAddress.
    • core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified regression tests for PT_LOAD overflow, uncovered PT_SCE_RELRO overflow, and the valid edge case where MappedAddress + MemorySize equals UINT64_MAX.
    • core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified updated virtual address translation test cases ('translation virtual boundary' and 'translation below segment and near virtual maximum'), ensuring the fixtures configure valid non-overflowing segments while thoroughly exercising TranslateVirtualAddress.
    • AGENTS.md conventions and portability: Verified zero comments in code, valid Conventional Commit format, no title special-casing, no extra files added, and portable 64-bit integer handling across Linux (LP64) and Windows (LLP64).
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912737873 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-5912737873). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T20:24:08Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `72b88e2852`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `elf_reader_bounds_tests` built cleanly. - **CTest** (`elf_reader_bounds`): ``` 1/1 Test #4966: elf_reader_bounds ................ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/relinker/relinker/src/parsing/ElfReader.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4966: elf_reader_bounds ................***Failed 0.00 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that PT_LOAD virtual address range overflow is checked using ph.MemorySize > std::numeric_limits<std::uint64_t>::max() - ph.MappedAddress, safely preventing unsigned integer overflow. - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that uncovered PT_SCE_RELRO segments undergo address range overflow validation before conversion into synthetic PT_LOAD segments, whereas covered PT_SCE_RELRO segments are already bounded by their validated parent PT_LOAD segments. - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified exception types and arguments, ensuring RelinkerException is thrown with the exact expected error messages ('PT_LOAD address range overflow' and 'PT_SCE_RELRO address range overflow') and FailureOffset set to MappedAddress. - core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified regression tests for PT_LOAD overflow, uncovered PT_SCE_RELRO overflow, and the valid edge case where MappedAddress + MemorySize equals UINT64_MAX. - core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified updated virtual address translation test cases ('translation virtual boundary' and 'translation below segment and near virtual maximum'), ensuring the fixtures configure valid non-overflowing segments while thoroughly exercising TranslateVirtualAddress. - AGENTS.md conventions and portability: Verified zero comments in code, valid Conventional Commit format, no title special-casing, no extra files added, and portable 64-bit integer handling across Linux (LP64) and Windows (LLP64). - Note: the AI-assisted checkbox can stay. Looks Good To Me
PrivacyOnion commented 2026-11-15 20:24:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:24:09Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 72b88e2852:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: elf_reader_bounds_tests built cleanly.
  • CTest (elf_reader_bounds):
    1/1 Test #4966: elf_reader_bounds ................   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/relinker/relinker/src/parsing/ElfReader.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4966: elf_reader_bounds ................***Failed    0.00 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that PT_LOAD virtual address range overflow is checked using ph.MemorySize > std::numeric_limitsstd::uint64_t::max() - ph.MappedAddress, safely preventing unsigned integer overflow.
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that uncovered PT_SCE_RELRO segments undergo address range overflow validation before conversion into synthetic PT_LOAD segments, whereas covered PT_SCE_RELRO segments are already bounded by their validated parent PT_LOAD segments.
    • core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified exception types and arguments, ensuring RelinkerException is thrown with the exact expected error messages ('PT_LOAD address range overflow' and 'PT_SCE_RELRO address range overflow') and FailureOffset set to MappedAddress.
    • core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified regression tests for PT_LOAD overflow, uncovered PT_SCE_RELRO overflow, and the valid edge case where MappedAddress + MemorySize equals UINT64_MAX.
    • core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified updated virtual address translation test cases ('translation virtual boundary' and 'translation below segment and near virtual maximum'), ensuring the fixtures configure valid non-overflowing segments while thoroughly exercising TranslateVirtualAddress.
    • AGENTS.md conventions and portability: Verified zero comments in code, valid Conventional Commit format, no title special-casing, no extra files added, and portable 64-bit integer handling across Linux (LP64) and Windows (LLP64).
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912737993 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-5912737993). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T20:24:09Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `72b88e2852`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `elf_reader_bounds_tests` built cleanly. - **CTest** (`elf_reader_bounds`): ``` 1/1 Test #4966: elf_reader_bounds ................ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/relinker/relinker/src/parsing/ElfReader.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4966: elf_reader_bounds ................***Failed 0.00 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that PT_LOAD virtual address range overflow is checked using ph.MemorySize > std::numeric_limits<std::uint64_t>::max() - ph.MappedAddress, safely preventing unsigned integer overflow. - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified that uncovered PT_SCE_RELRO segments undergo address range overflow validation before conversion into synthetic PT_LOAD segments, whereas covered PT_SCE_RELRO segments are already bounded by their validated parent PT_LOAD segments. - core/relinker/relinker/src/parsing/ElfReader.cpp:ReadProgramHeaders: Verified exception types and arguments, ensuring RelinkerException is thrown with the exact expected error messages ('PT_LOAD address range overflow' and 'PT_SCE_RELRO address range overflow') and FailureOffset set to MappedAddress. - core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified regression tests for PT_LOAD overflow, uncovered PT_SCE_RELRO overflow, and the valid edge case where MappedAddress + MemorySize equals UINT64_MAX. - core/relinker/relinker/tests/ElfReaderBoundsTests.cpp: Verified updated virtual address translation test cases ('translation virtual boundary' and 'translation below segment and near virtual maximum'), ensuring the fixtures configure valid non-overflowing segments while thoroughly exercising TranslateVirtualAddress. - AGENTS.md conventions and portability: Verified zero comments in code, valid Conventional Commit format, no title special-casing, no extra files added, and portable 64-bit integer handling across Linux (LP64) and Windows (LLP64). - Note: the AI-assisted checkbox can stay. Looks Good To Me
MarcZX10 commented 2026-11-21 04:20:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:20:01Z.

Review: APPROVED


Reviewed — looks good

The change at head 72b88e285290240508cce3314ccda0de210cb91f rejects overflowing load and uncovered RELRO ranges, and the inspected implementation and regression cases support merging.

What I ran

Read the prepared diff and both changed files at the pinned head. No build or tests were run in this review; the test results in the PR description are author-reported.

Results

Check Result Note
Source review passed Both changed files read
Tests not run Author reports targeted tests passed
Full suite not run Author reports it was not run

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

No commands, build, or tests were run. The author-reported test outcomes and convention check were not independently verified. All changed files listed in the manifest were read; no files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002781499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-6002781499). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T04:20:01Z. **Review:** APPROVED --- # Reviewed — looks good The change at head `72b88e285290240508cce3314ccda0de210cb91f` rejects overflowing load and uncovered RELRO ranges, and the inspected implementation and regression cases support merging. ## What I ran Read the prepared diff and both changed files at the pinned head. No build or tests were run in this review; the test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Both changed files read | | Tests | not run | Author reports targeted tests passed | | Full suite | not run | Author reports it was not run | ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [ElfReader.cpp at reviewed head](https://github.com/boykopovar/AnyPS5/blob/72b88e285290240508cce3314ccda0de210cb91f/core/relinker/relinker/src/parsing/ElfReader.cpp) - [ElfReaderBoundsTests.cpp at reviewed head](https://github.com/boykopovar/AnyPS5/blob/72b88e285290240508cce3314ccda0de210cb91f/core/relinker/relinker/tests/ElfReaderBoundsTests.cpp) ## Not verified No commands, build, or tests were run. The author-reported test outcomes and convention check were not independently verified. All changed files listed in the manifest were read; no files were excluded by the manifest. ## To get this to a good state Nothing is required.
catminou4 commented 2026-11-25 06:56:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by catminou4 on 2026-11-25T06:56:05Z.

Review: CHANGES_REQUESTED


Reviewed at 72b88e2852, both on its own head and applied on main 7a1c9bbccf, relinker-only Release build (GCC, Ubuntu 22.04).

  • ctest -R '^elf_reader_bounds$': passes. Control: with ElfReader.cpp from main, load address range overflow and uncovered SCE RELRO address range overflow before PT_LOAD conversion fail (Invalid program header was accepted); restoring the PR source passes again.
  • Regression: full relinker ctest now fails guest_load_ranges, on the PR head and on main + PR:
    empty-last-address-overflow: Expected Invalid load segment, got PT_LOAD address range overflow
    empty-first-address-overflow: Expected Invalid load segment, got PT_LOAD address range overflow
    
    GuestLoadRangesTests.cpp:76-80 (a segment at UINT64_MAX with p_memsz 1) was already rejected on main, just later. The new ElfReader check catches it first with a different message. Update those expectations, or use the existing diagnostic.
  • Moving translation virtual boundary / translation ... near virtual maximum away from UINT64_MAX - 31 is expected: a segment that ends at 2^64 is now rejected.

Not mergeable until guest_load_ranges passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6053132071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-6053132071). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T06:56:05Z. **Review:** CHANGES_REQUESTED --- Reviewed at 72b88e2852, both on its own head and applied on `main` 7a1c9bbccf, relinker-only Release build (GCC, Ubuntu 22.04). - `ctest -R '^elf_reader_bounds$'`: passes. Control: with `ElfReader.cpp` from `main`, `load address range overflow` and `uncovered SCE RELRO address range overflow before PT_LOAD conversion` fail (`Invalid program header was accepted`); restoring the PR source passes again. - **Regression:** full relinker `ctest` now fails `guest_load_ranges`, on the PR head and on `main` + PR: ``` empty-last-address-overflow: Expected Invalid load segment, got PT_LOAD address range overflow empty-first-address-overflow: Expected Invalid load segment, got PT_LOAD address range overflow ``` `GuestLoadRangesTests.cpp:76-80` (a segment at `UINT64_MAX` with `p_memsz` 1) was already rejected on `main`, just later. The new `ElfReader` check catches it first with a different message. Update those expectations, or use the existing diagnostic. - Moving `translation virtual boundary` / `translation ... near virtual maximum` away from `UINT64_MAX - 31` is expected: a segment that ends at 2^64 is now rejected. Not mergeable until `guest_load_ranges` passes.
ligmaSec commented 2026-12-03 11:55:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:55:28Z.

Review: COMMENTED


Built this head with ANYPS5_RELINKER_ONLY=ON and ran the repository’s elf_reader_bounds suite on Linux. It passed, including the added segment-address overflow checks.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6169255538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-6169255538). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T11:55:28Z. **Review:** COMMENTED --- Built this head with `ANYPS5_RELINKER_ONLY=ON` and ran the repository’s `elf_reader_bounds` suite on Linux. It passed, including the added segment-address overflow checks. AI-assisted: yes.
MarcZX10 commented 2026-12-04 02:19:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T02:19:39Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this; the points below are optional.

What I ran

Reviewed head f071650e83bfc24a5cdf0468ed3e1c33dcda4319. Read the prepared description, commits, manifest and diff, plus the changed code and relevant test sections using repo_read.py. No tests or builds were run.

Results

Check Result Note
Diff and changed code review passed Two changed files reviewed
Tests and build not run Description reports targeted tests passed
Excluded files not applicable None listed

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not independently run the reported test suites or convention check, or verify CI results. No files were excluded by the manifest.

To get this to a good state

Nothing is required.

Sources

The new PT_LOAD and uncovered PT_SCE_RELRO range checks and their boundary cases are in ElfReader.cpp and ElfReaderBoundsTests.cpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6182058171 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19470#pullrequestreview-6182058171). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-04T02:19:39Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this; the points below are optional. ## What I ran Reviewed head `f071650e83bfc24a5cdf0468ed3e1c33dcda4319`. Read the prepared description, commits, manifest and diff, plus the changed code and relevant test sections using `repo_read.py`. No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code review | passed | Two changed files reviewed | | Tests and build | not run | Description reports targeted tests passed | | Excluded files | not applicable | None listed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not independently run the reported test suites or convention check, or verify CI results. No files were excluded by the manifest. ## To get this to a good state Nothing is required. ## Sources The new PT_LOAD and uncovered PT_SCE_RELRO range checks and their boundary cases are in [ElfReader.cpp](https://github.com/boykopovar/AnyPS5/blob/f071650e83bfc24a5cdf0468ed3e1c33dcda4319/core/relinker/relinker/src/parsing/ElfReader.cpp#L157-L160) and [ElfReaderBoundsTests.cpp](https://github.com/boykopovar/AnyPS5/blob/f071650e83bfc24a5cdf0468ed3e1c33dcda4319/core/relinker/relinker/tests/ElfReaderBoundsTests.cpp#L322-L340).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/19470:upstream-pr/19470'
git switch 'upstream-pr/19470'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/19470'
git switch 'upstream-pr/19470'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/19470'
git switch 'upstream-pr/19470'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/19470'
git switch 'main'
git merge --squash 'upstream-pr/19470'
git switch 'main'
git merge --ff-only 'upstream-pr/19470'
git switch 'main'
git merge 'upstream-pr/19470'
git push origin 'main'
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!19470
No description provided.