fix(tools): audit bundled module imports #4208

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4208 into main
MarcZX10 commented 2026-10-12 01:24:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T01:24:46Z.


What

When --modules is supplied, discover the relinker's module registry sidecars and audit those imports against built libraries and bundled module exports. Main executable imports that name a bundled module retain the existing module classification; imports originating inside a module are checked, including imports naming a sibling module. Fail with a clear error when a sidecar or converted module artifact is missing. Parse dynamic exports from sectionless ELF module outputs, and document the workflow.

Tested

  • python3 -m unittest tools.tests.test_import_audit — 38 tests passed on Linux.
  • Built the current relinker and ran its guest registry integration test; it passed.
  • Ran python3 tools/check_conventions.py --base upstream/main --head HEAD — passed.
  • git diff --check — passed.
  • Smoke-tested generated module sidecars and converted module exports against a real relinker output.

Checklist

  • Investigated the issue against current upstream/main.
  • Added regression coverage for module imports, sibling exports, explicit sidecars, missing sidecars, and sectionless ELF exports.
  • Depends on: none
  • AI-assisted: yes

Limitations

Sectionless dynamic export parsing currently expects the SysV DT_HASH table emitted by the relinker. The audit must run beside the relinker output so it can locate app0/ converted modules.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823836743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4208). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T01:24:46Z. --- ### What When `--modules` is supplied, discover the relinker's module registry sidecars and audit those imports against built libraries and bundled module exports. Main executable imports that name a bundled module retain the existing module classification; imports originating inside a module are checked, including imports naming a sibling module. Fail with a clear error when a sidecar or converted module artifact is missing. Parse dynamic exports from sectionless ELF module outputs, and document the workflow. ### Tested - `python3 -m unittest tools.tests.test_import_audit` — 38 tests passed on Linux. - Built the current relinker and ran its guest registry integration test; it passed. - Ran `python3 tools/check_conventions.py --base upstream/main --head HEAD` — passed. - `git diff --check` — passed. - Smoke-tested generated module sidecars and converted module exports against a real relinker output. ### Checklist - [x] Investigated the issue against current `upstream/main`. - [x] Added regression coverage for module imports, sibling exports, explicit sidecars, missing sidecars, and sectionless ELF exports. - [x] Depends on: none - [x] AI-assisted: yes ### Limitations Sectionless dynamic export parsing currently expects the SysV `DT_HASH` table emitted by the relinker. The audit must run beside the relinker output so it can locate `app0/` converted modules.
MarcZX10 commented 2026-10-12 01:44:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T01:44:02Z.


The duplicate implementation appears in issue #4202: LeandroSSB posted commit 7ddd00a57 implementing module ELF import parsing, sibling exports, and regression coverage. The PR implementation adds relinker sidecar discovery and sectionless converted ELF exports beyond that issue comment, so could you clarify whether those additional workflows are needed to address the original report? In the meantime, I will close this PR to avoid competing implementations.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116270801 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4208#issuecomment-6116270801). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T01:44:02Z. --- The duplicate implementation appears in issue #4202: LeandroSSB posted commit `7ddd00a57` implementing module ELF import parsing, sibling exports, and regression coverage. The PR implementation adds relinker sidecar discovery and sectionless converted ELF exports beyond that issue comment, so could you clarify whether those additional workflows are needed to address the original report? In the meantime, I will close this PR to avoid competing implementations.
MarcZX10 commented 2026-10-12 01:44:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T01:44:03Z.


Closing as duplicate of the implementation posted in #4202 by LeandroSSB. That implementation also addresses module import auditing and its regression tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116270981 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4208#issuecomment-6116270981). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T01:44:03Z. --- Closing as duplicate of the implementation posted in #4202 by LeandroSSB. That implementation also addresses module import auditing and its regression tests.

Pull request closed

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!4208
No description provided.