fix(tools): reject dynamic tables without DT_NULL in import_audit #10311
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10311"
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 MarrasFederico on 2026-10-23T17:26:30Z.
What
tools/import_audit.pyread an ELF dynamic table untilDT_NULLor the end of the table, so aPT_DYNAMICsegment or.dynamicsection with noDT_NULLentry was accepted and audited with whatever entries it held. The ELF gABI ends the_DYNAMICarray withDT_NULL, and the relinker rejects such a module:RelativeRelocationIndex.cppthrowsUnterminated dynamic segment. An audit could therefore report a module's imports as satisfied although the relinker would refuse the module.Both readers now fail with
AuditErrorwhen the table has noDT_NULL: the program-header reader used for modules without section headers (dynamic segment is not terminated by DT_NULL) and the section reader (dynamic section is not terminated by DT_NULL). The command then exits with 2 and writes no JSON report, as for the other malformed inputs. Entries afterDT_NULLare still ignored, so padding past the terminator keeps working (#5283 made the dependency walk stop there).Tested
Ubuntu 26.04.1, Python 3.13,
python3 -m unittest test_import_auditintools/tests. Windows was not run. No title was run.main(1 skipped, as onmain).test_elf_dynamic_tables_require_dt_nullreplaces the last entry of a section-less module'sPT_DYNAMICand of a sectioned module's.dynamicwith a non-null tag: both readers raise, and the command exits with 2, prints the error and leaves no JSON report. It fails withmain'simport_audit.py.test_sectionless_dynamic_padding_after_dt_null_is_ignoredappends aDT_NEEDED-shaped entry afterDT_NULLand checks the symbols and dependencies are unchanged.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyfinds no conflicting lines; it could not compare #6171 and #7454, which conflict withmain. Neither changes the dynamic-table loops (they change module identities and$ORIGINdependency resolution).Checklist
main; no other open PR implements the same functionsNotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-24T10:02:21Z.
Review: APPROVED
Reviewed head
1723ade7ba5c283544cc44c0209028b1cfa14403against pinned baseaeeaefad98613c63a49ea2daae4d4558304b14cd. No actionable findings in this focused review.In
tools/import_audit.py,elf_program_dynamic_symbolsandelf_importspreviously accepted dynamic tables that exhausted their declared entries withoutDT_NULL. Both now raiseAuditErrorunless they encounter the terminator. The checks preserve the existing size validation and stop at the first terminator, so trailing entries remain ignored. I inspected both malformed fixtures, sectionless padding, the existing sectioned terminator test, and error propagation throughread_modulesandmain; parsing errors return 2 before JSON output is written.Controller-recorded execution of
tools/tests/test_import_audit.pyused Windows AMD64 and Python 3.11.9. Baseline reported 133 tests with 3 skipped (130 passed); pristine PR and candidate each reported 135 with 3 skipped (132 passed). The baseline-source/candidate-tests negative control failed because the unterminated sectionless table raised noAuditError, confirming the intended old behavior rather than a setup failure. Its first failed assertion prevents the later assertions from running in that control. Local whitespace and conventions checks also succeeded.GitHub-reported effective checks succeeded for
conventions,labels,eligibility,relinker-asan, and the relinker jobs named for Ubuntu/g++, Windows/g++, and both macOS/clang++ variants.linux,windows,write-watch, andregister-contextwere skipped. Workflow identity evidence confirms the older cancelled conventions execution was superseded; no effective execution is failing or pending.The author's Ubuntu/Python 3.13 results remain author-reported. No local native build, game, or GPU validation was recorded. The inspected source and focused regression evidence support approval.