fix(relinker): reject ambiguous dynamic table metadata #1938
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1938"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-09T01:26:17Z.
What
The main relinker reads the first
PT_DYNAMICheader and the first occurrence of consumed table metadata. A second header is ignored on Linux, while conflicting relocation tags can select different tables in the pipeline and strict reachability's relative-relocation index. Windows detects some duplicates later, after an optional import registry has been written. Reject multiple dynamic headers before reading the dynamic table, and reject a repeated tag when the pipeline consumes its value, before either output patcher runs.Identical duplicates are rejected too. This is AnyPS5's supported-input policy, consistent with the bundled-module reader's duplicate guards; it is not a claim that the ELF gABI requires every dynamic header or tag to be unique. The tag guard covers only the 11 currently consumed standard/SCE pairs for string, symbol, RELA and PLT table addresses, sizes, strides and type.
DT_NEEDED, distinct SCE module-import records and ignored tags retain their existing behavior. Other tags, including the existingDT_INITambiguity, are outside this change. Existing OS-versus-standard ambiguity diagnostics remain intact.Extend
dynamic_segmentwith the same, different, empty and out-of-bounds second table in both header orders. Registerdynamic_tag_duplicatesfor identical and conflicting values in both tag orders and both tag families. Every duplicate rejection must return status 2, identify the duplicate, and create neither an executable nor an import registry. Valid controls include trailing records afterDT_NULL, repeatable imports, and outputDT_NEEDEDorder in bothlibA.so, libB.soand reverse lexicallibB.so, libA.soorder. Tests use synthetic input and generate both Linux ELF and Windows PE output.Tested
The duplicate-header and duplicate-tag regressions fail against base
f145139676and pass with this patch. Reverse lexical DT_NEEDED order passes without sorting the dependencies. Zorin OS 18.1 x86-64, GCC 13.3.0, Python 3.12 and CMake 3.28.3, relinker-only Release/static, one build job. Author validation of the composed four patches passed all 39 configured CTest registrations in 6.06 s, including progress_report and import_audit; exact-base baseline passed 38/38 in 5.93 s. A separate independent review rebuilt the composed revision and passed 39/39 in 6.03 s. Focused baseline and patched checks use small synthetic inputs. Existing assertions are retained; no real game, firmware, private asset or GPU input was used.No native Windows or macOS runtime, real title, firmware, private asset or GPU input was tested. Windows PE generation on Linux is structural coverage. No cross-PR merge or runtime validation is claimed.
Checklist
f145139676a48306681d3a4d5fabf83938759daf; the 2026-10-09 overlap audit found no equivalent implementationOpen PRs #1272, #1446, #1617 and #1690 share
RelinkerPipeline.cppfor other work. #1690 and #1913 also change test registration. A fresh overlap check found no equivalent open implementation. No functional dependency on those PRs.Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-09T05:58:29Z.
Regarding the overlap warning: #2001 deletes
test_dynamic_segment.pyand removes nearby CMake registrations that this PR extends. I reproduced the CMake three-way conflict; the test has a modify/delete conflict. I found no equivalent duplicate-metadata validation or functional dependency, soDepends on: noneremains accurate. No current code change is justified at verified head8ee833159f27cb16c0d25eca0f90569152c2942c. These test/registration conflicts need resolution if either PR changesmainfirst.Fresh, serial relinker-only Release tests on Zorin OS 18.1 x86-64 / GCC 13.3: PR head 39/39 passed (6.32 s); exact base
f145139676a48306681d3a4d5fabf83938759daf38/38 passed (6.19 s). Both published duplicate regressions fail against base and pass on the PR head. Windows PE generation was structural coverage on Linux; native Windows/macOS and hardware execution were not tested. This review and validation were AI-assisted.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:08:19Z.
Closing: no title is shown with a second
PT_DYNAMICor repeated table tags, and rejecting identical duplicates could refuse an input the console loads. Please reopen with the title whose conversion goes wrong because of it.Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-09T20:32:08Z.
Understood. The synthetic tests do not establish a title whose conversion fails because of this metadata. Rejecting identical duplicates could also reject input the console accepts; the tests do not establish compatibility. I have no affected-title evidence supporting this change and accept keeping the PR closed.
AI-assisted review and reply.
Pull request closed