Repository navigation
fix(relinker): reject zero DT_RELR address when relocation table size is non-zero - #14505
slopgobblercobbler wants to merge 1 commit into
Conversation
|
Thanks for looking at the RELR metadata checks; a present
Reviewed at |
MarcZX10
left a comment
There was a problem hiding this comment.
Changes requested — a notes file is committed at the root, and the new test is not registered
Two blocking items. First, pr_body.txt is committed at the repository root, and the checklist forbids notes files in the repository. Second, the new test core/relinker/tests/RelrBoundsTests.cpp is not referenced by any CMake file, so it never builds or runs. The relinker lists each test explicitly, for example relr_relocations_tests at core/relinker/CMakeLists.txt line 279. Please remove the notes file, and register the test or fold its case into RelrRelocationTests.cpp, which already runs as relr_relocations_tests.
What I ran
- Head
f8c5ce4300baf5d4ae1649e0d690078b74d22244; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 3 files:core/relinker/relinker/src/parsing/RelrRelocations.cpp(one condition), the newcore/relinker/tests/RelrBoundsTests.cpp, andpr_body.txtat the repository root. - Confirmed
pr_body.txtexists in the head tree at the root. - Searched every CMake file at the head for
RelrBoundsTests: no match.relr_relocations_testsis atcore/relinker/CMakeLists.txtline 279. - Read the one-line change:
if (!address || *address == 0 || !size || !stride)in place ofif (!address || !size || !stride)(RelrRelocations.cpp, base line 28). - 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 (no export changed).
- Hosted: the relinker ubuntu g++, windows g++, asan and macOS jobs passed; there is no main windows job.
- 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 |
| No notes files in the repository | failed | pr_body.txt is committed at the repository root |
| New test is registered and runs | failed | RelrBoundsTests.cpp is not in any CMake file |
*address == 0 rejects a zero DT_RELR address |
not run | the new test would check it, but it does not run |
| 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 | passed | relinker jobs passed; no main windows job |
Read-only check output
Precheck was not run: this session does not run code from PR heads. Hosted: gh api repos/boykopovar/AnyPS5/commits/f8c5ce4300baf5d4ae1649e0d690078b74d22244/check-runs.
Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
pr_body.txtis committed at the repository root. The checklist says no notes or investigation files are added to the repository; please remove it from the PR.core/relinker/tests/RelrBoundsTests.cppis not registered in any CMake file, so the new case never runs. Please register it, or add the case toRelrRelocationTests.cpp, which already runs asrelr_relocations_tests.
Non-blocking
- The change is a production behaviour change, not only a test: a zero
DT_RELRaddress withDT_RELRSZpresent is now rejected (RelrRelocations.cppline 28). The title ("test(relinker): cover DT_RELRSZ present with null relocation table pointer") and the PR body ("Add test coverage") do not say so. Please state it in the title and body.
Sources
- Changed condition: https://github.com/boykopovar/AnyPS5/blob/f8c5ce4300baf5d4ae1649e0d690078b74d22244/core/relinker/relinker/src/parsing/RelrRelocations.cpp
- New test: https://github.com/boykopovar/AnyPS5/blob/f8c5ce4300baf5d4ae1649e0d690078b74d22244/core/relinker/tests/RelrBoundsTests.cpp
- Notes file at the root: https://github.com/boykopovar/AnyPS5/blob/f8c5ce4300baf5d4ae1649e0d690078b74d22244/pr_body.txt
- Existing registration:
AnyPS5/core/relinker/CMakeLists.txt
Line 279 in f2d874c
Not verified
- The new test was not run; it is not registered, so it cannot run in the hosted jobs.
- The relinker jobs' test lists were not read.
To get this to a good state
- Remove
pr_body.txt, register the test (or move the case intoRelrRelocationTests.cpp), and state the behaviour change in the title and body.
adriadam10
left a comment
There was a problem hiding this comment.
Same points as the earlier reviews are still open on this head:
core/relinker/tests/RelrBoundsTests.cppis not registered incore/relinker/CMakeLists.txt(andcore/relinker/tests/does not exist), so it never builds or runs. Move the case intocore/relinker/relinker/tests/RelrRelocationTests.cpp, which is registered.pr_body.txtat the repository root must be removed (no notes files in the repo).core/relinker/relinker/src/parsing/RelrRelocations.cpp:28changes behaviour:DT_RELR == 0withDT_RELRSZ/DT_RELRENTpresent now throws. Say which reference or real binary this follows; once the test runs, it must fail onmainand pass here.- The test's
catch (const std::exception& error)swallows the message, and the case list only covers one row (DT_RELR0). Also cover the missing-tag variants if that is the contract.
f8c5ce4 to
78ba826
Compare
|
@slopgobblercobbler I reviewed head 78ba826. The title and body describe a test, but the diff also changes RelrRelocations.cpp, so please fix these:
adriadam10 has an open change request on this head, so please address it too. |
78ba826 to
d70e0e7
Compare
|
Addressed maintainer feedback:
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head d70e0e72a6f005fac6a590105233f85cc02ea34a by reading the prepared diff, both changed files, and the call-site search results. No commands or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | Both changed files read |
| Unit tests | not run | Execution was not available |
| Convention check | not run | Execution was not available |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports unit test execution and a clean convention check; neither was independently verified. No tests were run. The prepared review artifacts included description.md, commits.md, manifest.json, and diff.patch. files.json was unavailable; the file listing showed both changed files as included, and both were read. No changed files were excluded.
To get this to a good state
Nothing is required.
|
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) |
catminou4
left a comment
There was a problem hiding this comment.
Reviewed at d70e0e7, applied on main 7a1c9bb, relinker-only Release build (GCC, Ubuntu 22.04).
ctest -R '^relr_relocations$': passes. Full relinkerctest(1116 tests): no new failures (onlytools_headers_manifest, which also fails onmainin this environment).- Control: with
RelrRelocations.cppfrommain,relr_relocationsfails (RELR validation failed); restoring the PR source passes again. - The control proves the diagnostic more than a new rejection: the fixture maps vaddr 0 to file offset 0, so
mainreads the ELF magic (odd word) as a bitmap and still rejects, only withbitmap precedes address. A layout where vaddr 0 is not file offset 0 would be the onemainaccepts silently; not covered here. - Zero address with zero size still returns empty, as before.
- No textual conflict with #14127, #14582 or #23861 (same files).
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 zero table address and nonzero table size regression.
AI-assisted: yes.
What
Reject a zero
DT_RELRaddress when relocation table size is non-zero, while preserving empty result for zero-size tables. Move test coverage to registeredRelrRelocationTests.cppand remove extraneous notes and unregistered files.Tested
Verified via unit test execution in
RelrRelocationTests.cppand zero findings withtools/check_conventions.py --base upstream/main.Checklist
NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)