Repository navigation
test(relinker): cover non-8-aligned target addresses in RELR unpacking - #14582
slopgobblercobbler wants to merge 1 commit into
Conversation
|
Thanks for looking at RELR address entries. As written, though, the change breaks the existing registered RELR test and its own test never runs:
Reviewed at |
MarcZX10
left a comment
There was a problem hiding this comment.
Changes requested — the new RELR check breaks three existing relinker tests, and the new test is not registered
The new check (RelrRelocations.cpp, "Misaligned RELR target address") rejects inputs that the existing RELR tests expect to convert. In the hosted Ubuntu g++ relinker job, relr_relocations, relr_conversion and guest_relr_conversion fail with that message. The Python fixture test_relr_relocations.py reports zero-fill-addends (target 0xffc) and partial-overlap failing with "Misaligned RELR target address". The macOS and Windows g++ relinker jobs also failed; I read only the Ubuntu log. In addition, the new test file core/relinker/tests/RelrMisalignedAddr.cpp is not referenced by any CMake file, so it never runs.
What I ran
- Head
7b90505ddd82cea528e5ecfc984e6aa203a58738; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 3 files:core/relinker/relinker/src/parsing/RelrRelocations.cpp(+1, the new check) and the newcore/relinker/tests/RelrMisalignedAddr.cpp(+67). - Searched every CMake file at the head for
RelrMisalignedAddr: no match.relr_relocations_testsis atcore/relinker/CMakeLists.txtline 279. - Read the hosted logs: the Ubuntu g++ job's CTest list (
relr_relocations,relr_conversion,guest_relr_conversionFailed; exit code 8) and its Python output (test_relr_relocations.py, line 171 and 182). - Read-only checks from the trusted main checkout (precheck not run: this session does not run code from PR heads): diff check and conventions passed; the ABI audit is not applicable.
- Hosted: relinker ubuntu g++, windows g++ and macOS (both) failed; relinker asan passed; the main windows job was skipped.
- No MarcZX10 review at this head.
Results
| Check | Result | Note |
|---|---|---|
| Diff check | passed | |
| Conventions and PR template | passed | conventions check from the main checkout |
| Mergeability and dependencies | passed | depends on none; the stack check passed |
Existing relr_relocations, relr_conversion, guest_relr_conversion |
failed | Ubuntu g++ job; exit code 8 (the new check rejects their inputs) |
zero-fill-addends and partial-overlap fixtures |
failed | "Misaligned RELR target address" in test_relr_relocations.py |
New test RelrMisalignedAddr.cpp |
not run | not registered in any CMake file |
| Relinker jobs (hosted) | failed | ubuntu g++, windows g++ and macOS (both) failed; asan passed |
| ABI audit | not applicable | no exported symbol changed |
| Build and runtime tests | not run | no local build |
| Negative controls | not run | no local build |
| Hosted CI | failed | relinker jobs failed (see above); the main windows job was skipped |
Read-only check output
Precheck was not run: this session does not run code from PR heads. Hosted: gh api repos/boykopovar/AnyPS5/commits/7b90505ddd82cea528e5ecfc984e6aa203a58738/check-runs. Ubuntu CTest failures: 349 - relr_relocations (Failed), 391 - relr_conversion (Failed), 392 - guest_relr_conversion (Failed), exit code 8.
Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
- The new check breaks existing tests. In the Ubuntu g++ relinker job,
relr_relocations,relr_conversionandguest_relr_conversionfail with "Misaligned RELR target address", and the Python fixtureszero-fill-addends(target 0xffc) andpartial-overlapexpect conversions instead. Please reconcile the check with those fixtures (either the fixtures are wrong, or the rule is too strict), and rerun the relinker jobs. The macOS and Windows g++ jobs also failed; their logs were not read. core/relinker/tests/RelrMisalignedAddr.cppis not registered in any CMake file, so the new case never runs. Please register it, or move it intoRelrRelocationTests.cpp, which already runs asrelr_relocations_tests.
Non-blocking
- The title ("test(relinker): cover misaligned target address in RELR unpacking") describes a test, but the diff adds a production rejection. Please state the behaviour change in the title and body.
Sources
- New check: https://github.com/boykopovar/AnyPS5/blob/7b90505ddd82cea528e5ecfc984e6aa203a58738/core/relinker/relinker/src/parsing/RelrRelocations.cpp
- New test: https://github.com/boykopovar/AnyPS5/blob/7b90505ddd82cea528e5ecfc984e6aa203a58738/core/relinker/tests/RelrMisalignedAddr.cpp
- Existing registration:
AnyPS5/core/relinker/CMakeLists.txt
Line 279 in f2d874c
Not verified
- The macOS and Windows g++ relinker logs were not read.
- The fixture expectations were not checked against the RELR specification beyond the failing messages.
To get this to a good state
- Reconcile the check with the existing RELR fixtures, register or fold the new test, state the behaviour change, and rerun the relinker jobs.
adriadam10
left a comment
There was a problem hiding this comment.
core/relinker/relinker/src/parsing/RelrRelocations.cpp:80: the newMisaligned RELR target addressthrow is a behaviour change, not test coverage. An RELR address entry only needs bit 0 clear; the existingRelrRelocationTests.cppaccepts0x202and0x1ffc. It failsrelr_relocations,relr_conversionandguest_relr_conversionin the relinker jobs on Linux, macOS and Windows.core/relinker/tests/RelrMisalignedAddr.cppis not registered incore/relinker/CMakeLists.txt(add_test_executable+add_test), so it never runs; the "executed successfully" line in Tested cannot be true for it. It also asserts rejection of0x202, which contradicts the existing test.- Fix: drop the throw and this test, or, if you have a reference showing real RELR tables never carry non-8-aligned addresses, cite it, update the existing tests and register the new one so it fails without the change.
|
Windows check of head Setup: Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
7b90505 to
cd7592b
Compare
|
Thanks @oneandonlydean, @MarcZX10, and @adriadam10 for the reviews! Updated head
Ready for re-review. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The test adds positive controls for even RELR target addresses that are not 8-byte aligned, and the assertions match the existing relinker behavior.
What I ran
Reviewed head cd7592b275e1da37938817955128a5b0893255b5 using the prepared diff and pinned reader. No test commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Changed test lines | passed | All four added lines read |
| Test execution | not run | No build or test run performed |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports convention checks and a passing test build; these were not run during this review. No files were excluded in the manifest. Read RelrRelocationTests.cpp in full and RelrRelocations.cpp for the behavior exercised; also read description.md, commits.md, manifest.json, diff.patch, and the review-folder README. files.json was not available through the reader.
To get this to a good state
Nothing is required.
|
The fix for PR #14582 has been force-pushed (commit
|
cd7592b to
03bda9f
Compare
|
@oneandonlydean @soupap08 @adriadam10 @MarcZX10 Branch rebased cleanly on latest
|
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
03bda9f to
fcc8b26
Compare
|
Rebased cleanly onto latest
|
catminou4
left a comment
There was a problem hiding this comment.
Reviewed at fcc8b26, applied on main 7a1c9bb, relinker-only Release build (GCC, Ubuntu 22.04).
ctest -R '^relr_relocations$': passes. Full relinkerctest: no new failures (onlytools_headers_manifest, environmental, also fails onmain).- Checked the expected addends by hand: the fixture writes
offset + 0x900at every 8-byte slot, so the bytes from 0x204 are00 00 00 00 08 0b 00 00→0x00000b0800000000, and from 0x20600 00 08 0b 00 00 00 00→0x000000000b080000. Both match. - Test-only; no textual conflict with #14505, #14127 or #23861.
Mergeable.
ligmaSec
left a comment
There was a problem hiding this comment.
Built this head with ANYPS5_RELINKER_ONLY=ON and ran relr_relocations on Linux. It passed, including the added non-eight-aligned target case.
AI-assisted: yes.
What
Add test coverage for even, non-8-aligned target addresses (0x204 and 0x206) as positive controls in the registered RelrRelocationTests fixture alongside existing 0x202 and 0x1ffc cases.
Per DT_RELR specification and existing AnyPS5 relinker behavior, an RELR address entry only requires bit 0 clear (even target), not an 8-byte multiple; bitmap entries subsequently step in 8-byte increments. Reverts the rejected production throw from RelrRelocations.cpp, removes the unregistered RelrMisalignedAddr.cpp, and folds the positive controls directly into the registered RelrRelocationTests.cpp suite.
Tested
relr_relocations_testswith CTest (ctest --test-dir build -C Release -R relr_relocations -V), passing all assertions.python tools/check_conventions.py --base upstream/main --head HEADpasses with 0 findings.Checklist