fix(relinker): reject incomplete RELA entries #1194

Merged
ASVLCII merged 1 commit from upstream-pr/1194 into main 2026-10-08 08:49:20 +00:00
ASVLCII commented 2026-10-07 17:11:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ASVLCII on 2026-10-07T17:11:04Z.


What

Reject DT_RELASZ and DT_OS_RELASZ values that aren't multiples of the supported 24-byte RELA entry size. Linux conversion previously processed complete entries and silently discarded the trailing partial entry.

The check lives in the shared pipeline. The new synthetic regression covers 32 combinations across both size-tag variants and Linux/Windows output, including valid sizes of 0, 24, and 48 bytes, partial entries, and UINT64_MAX. Valid Linux outputs are checked for their relocation-table sizes.

This is separate from #917's overflow-safe relocation bounds check and #1087's ELF header validation. No dependency on either patch.

Tested

Testing ran in a Debian 13 x86-64 cloud environment with GCC 14.2.0. Only synthetic fixtures and existing repository tests were used.

  • The new regression fails against the preserved original upstream relinker and passes with the fix.
  • All 24 Python relinker tests passed. Relinker, default, and libs builds succeeded.
  • Conventions checks and git diff --check passed.
  • Both Linux and Windows output conversion were exercised from Linux. Native Windows execution and physical GPU testing were unavailable.

Broader testing across the initial run, serialized continuation, and isolated rechecks recorded 374 passes, 23 skips, and three failures:

  • agc_driver_emulated_color_compare: lavapipe returned 0.0 where 0.35 was expected.
  • agc_driver_flat_store: OOM-killed at the cloud environment's 32 GiB memory limit, including when run alone.
  • agc_driver_image_atomics64: unavailable VK_EXT_shader_image_atomic_int64 extension.

These failures were not reproduced on an unmodified upstream build, so they're not confirmed baseline failures. The full suite is not green. Skips included unavailable userfaultfd write tracking and larger subgroup widths.

AI-assisted: Codex investigated, implemented, and tested the patch in the cloud. The final diff was also reviewed before submission.

Checklist

  • Based on current main; no competing implementation of this size-alignment check found. #917 modifies the same pipeline for a different defect.
  • One topic per PR; follow-ups go in a new PR.
  • No code comments added.
  • Invalid relocation sizes throw; no unimplemented exports or silent stubs added.
  • No investigation reports, notes, or images added to the repository.
  • No third-party dependencies added.
  • Generic behaviour, not specific to one title.
  • Depends on: none.
  • AI-assisted: yes.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4775936822 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1194). Originally posted by [ASVLCII](https://github.com/ASVLCII) on 2026-10-07T17:11:04Z. --- ### What Reject `DT_RELASZ` and `DT_OS_RELASZ` values that aren't multiples of the supported 24-byte RELA entry size. Linux conversion previously processed complete entries and silently discarded the trailing partial entry. The check lives in the shared pipeline. The new synthetic regression covers 32 combinations across both size-tag variants and Linux/Windows output, including valid sizes of 0, 24, and 48 bytes, partial entries, and `UINT64_MAX`. Valid Linux outputs are checked for their relocation-table sizes. This is separate from #917's overflow-safe relocation bounds check and #1087's ELF header validation. No dependency on either patch. ### Tested Testing ran in a Debian 13 x86-64 cloud environment with GCC 14.2.0. Only synthetic fixtures and existing repository tests were used. * The new regression fails against the preserved original upstream relinker and passes with the fix. * All 24 Python relinker tests passed. Relinker, default, and libs builds succeeded. * Conventions checks and `git diff --check` passed. * Both Linux and Windows output conversion were exercised from Linux. Native Windows execution and physical GPU testing were unavailable. Broader testing across the initial run, serialized continuation, and isolated rechecks recorded 374 passes, 23 skips, and three failures: * `agc_driver_emulated_color_compare`: lavapipe returned 0.0 where 0.35 was expected. * `agc_driver_flat_store`: OOM-killed at the cloud environment's 32 GiB memory limit, including when run alone. * `agc_driver_image_atomics64`: unavailable `VK_EXT_shader_image_atomic_int64` extension. These failures were not reproduced on an unmodified upstream build, so they're not confirmed baseline failures. The full suite is not green. Skips included unavailable userfaultfd write tracking and larger subgroup widths. AI-assisted: Codex investigated, implemented, and tested the patch in the cloud. The final diff was also reviewed before submission. ### Checklist * [x] Based on current `main`; no competing implementation of this size-alignment check found. #917 modifies the same pipeline for a different defect. * [x] One topic per PR; follow-ups go in a new PR. * [x] No code comments added. * [x] Invalid relocation sizes throw; no unimplemented exports or silent stubs added. * [x] No investigation reports, notes, or images added to the repository. * [x] No third-party dependencies added. * [x] Generic behaviour, not specific to one title. * [x] Depends on: none. * [x] AI-assisted: yes.
adriadam10 commented 2026-10-08 08:49:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:49:17Z.


Checked: the new rela_size test fails on main and passes here; full ctest 427/427 and CI green on this head. The check mirrors the existing DT_PLTRELSZ % 24 one. No conflict with #1446 (same file, different check); merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6056240296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1194#issuecomment-6056240296). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T08:49:17Z. --- Checked: the new `rela_size` test fails on `main` and passes here; full ctest 427/427 and CI green on this head. The check mirrors the existing `DT_PLTRELSZ % 24` one. No conflict with #1446 (same file, different check); merging.
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!1194
No description provided.