Skip to content

fix(tools): flag qualified imports exported only under a NID - #9241

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
veosett:codex/audit-sdk-symbol-names
Oct 24, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
veosett:codex/audit-sdk-symbol-names

Conversation

@veosett

@veosett veosett commented Oct 21, 2026 •

Copy link
Copy Markdown

What

A library-qualified literal import such as strlen from libc.prx was reported as implemented with exit code 0 even when the provider exported only its NID. The loader requires the literal name and cannot resolve this import.

Preserve the implementation/stub class and report a separate symbol_mismatch flag and count. Show the unresolved name and exported NID, include strong mismatches in the current-stop selection, and return exit code 1. Preserve literal exports, unqualified NID fallback, guest-module priority and the existing weak-import audit policy.

Determine the mismatch during host-name fallback lookup, independently of the function's implementation class. This composes with #9372's partial class without taking that PR as a dependency. Add a regression for unresolved fallback and guest-module priority.

Found while investigating #9180. This changes the diagnostic tool; SDK conversion and runtime startup are outside its scope.

Tested

Refreshed onto main 0db47b263d1019043f7d28fad4e7ee0a1ea5ec6a. Final head: b7a6e9d245e190a0fc2ba1d26f7fc9a84c482b98.

Windows 11, Python 3.12.14, synthetic registries/providers; no compiler invocation.

  • Full test_import_audit.py suite: 126 tests, 123 passed, 3 skipped (two POSIX permission cases and the Windows symlink privilege case).
  • Before adapting this branch, git merge-tree with feat(tools): split guarded exports into a partial import_audit class #9372 conflicted in tools/import_audit.py. The adapted head merges cleanly with feat(tools): split guarded exports into a partial import_audit class #9372 at 72664d1ef99aca45fc3b6f17ddbd0653e4eae2eb.
  • Combined Git tree aea75d89e1f9a59c68aabb3c2d2eb194c36d5ff1, extracted outside the checkout: 128 tests, 124 passed, 4 skipped (the same three cases plus the source-commit check requiring a Git checkout).
  • 24 combined-tree cross-cases passed: implemented/stub/partial providers, literal/NID exports, qualified/unqualified imports, and strong/weak references. They verify mismatch reporting, summary counts and current-stop selection. A qualified NID-only partial provider still reports the name mismatch.
  • feat(tools): split guarded exports into a partial import_audit class #9372 remains independent; its commits were not merged into this branch. The check covers its exact SHA above.
  • python tools/check_conventions.py --base origin/main and git diff --check: passed.

No new WSL, title or native loader run, and no system-library build. Earlier validation below belongs to the preceding head.

Earlier validation on preceding heads

Base: cecb540a63f614d2b06cbb557c6d1f6f02475fa3. Tested head: d3fdb88745.

  • Regression on the base: all 8 ELF/PE, implemented/stub and strong/weak subcases incorrectly returned 0. With the fix they return 1, preserve the classification, and select only strong imports as current stops.
  • Windows x64, Python 3.12.14: 125 tests discovered, 122 passed, 3 skipped (two POSIX permission cases and the symlink case requiring an unavailable Windows privilege).
  • Ubuntu 24.04 WSL, Python 3.12.3, the same commit: 125 tests discovered, 124 passed, 1 skipped (Windows read-only replacement behavior).
  • Command on both systems: python -m unittest discover -s tools/tests -p test_import_audit.py -v.
  • The tests also cover exact literal exports alongside NID exports and preserve Windows unqualified-import fallback.
  • A separate merged-tree check with fix(tools): preserve weak guest module imports in audits #8718 (700be1869477a876cadc09bed94bac2239cfe209) and fix(tools): resolve Windows system library suffixes in audits #8719 (037ad5dd967f0f2e8e1ada34482973e607de6efb) merges cleanly and runs 130 tests on Windows: 126 passed, 4 skipped (the same three platform/privilege cases and the source-commit stamp case outside a Git checkout).
  • python tools/check_conventions.py --base origin/main and git diff --check origin/main...HEAD pass.
  • python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch codex/audit-sdk-symbol-names --jobs 4 completed with no confirmed overlap. Its legacy comparisons that conflict with main are qualified below.

No commercial title or SDK payload was executed, and system libraries were not rebuilt. This is a Python diagnostic change; no runtime or performance improvement is claimed.

The legacy shared-file changes in #6171 (guest module identities) and #7454 ($ORIGIN dependencies) were inspected and implement different behavior. Both already conflict with main, so their combined merge is unverified. The other legacy documentation-only comparisons concern different sections of USAGE.

Additional native loader validation on the same head, using fresh relinker-only builds on Windows x64 (WinLibs GCC 15.2.0) and Ubuntu 24.04 WSL (GCC 13.3): synthetic ELF inputs import shared#A#B from available.prx. Both audit versions read the registry produced by the actual relinker and the same provider files.

Provider export Actual Windows process Actual Linux process Audit on base Audit with this PR
9E8ipSX3c9g, the NID of shared unresolved ELF import shared from available.prx, status 0xC0000139 undefined symbol: shared, exit 127 Exit 0, no current stop Exit 1, current stop shared, symbol_mismatch: 1
Literal shared Expected provider return value 33 Expected provider exit value 33 Exit 0, no current stop Exit 0, no current stop, symbol_mismatch: 0

The synthetic processes actually ran on their native hosts. They validate the qualified-name diagnostic; they do not exercise the SDK CRT or title startup.

GitHub Build 39633560471 succeeded at d3fdb88745017415aa6f542230436ffe9bd0411d: relinker build/CTest on Ubuntu, Windows, macOS ARM64 and macOS x86_64, plus the ASan TLS-function-coverage job. The CTest steps themselves completed successfully. Full Linux/Windows system-library jobs were policy-skipped.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6171 docs/user/USAGE.md
tools/import_audit.py
tools/tests/test_import_audit.py
PR 6924 docs/user/USAGE.md
PR 7454 tools/import_audit.py
tools/tests/test_import_audit.py
PR 7642 docs/user/USAGE.md
PR 7918 docs/user/USAGE.md
PR 7942 docs/user/USAGE.md
PR 9408 docs/user/USAGE.md
PR 9508 docs/user/USAGE.md
PR 10193 docs/user/USAGE.md

@xXPBSXx

xXPBSXx commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Linux data point for d3fdb88745 (WSL2, Ubuntu 24.04, kernel 6.18 - a virtualised kernel, not bare-metal Linux; Python 3.12.3), this head merged onto main 950388bfd (clean merge), python3 -I tools/tests/test_import_audit.py:

  • With the PR: 125 tests OK, 1 skipped (Windows read-only behaviour).
  • Without it (the PR's test_import_audit.py on top of main without the PR's source change): FAILED (8 failures, 3 errors).
    Not tested: macOS, Windows.

AI-assisted (Claude Code).

@veosett
veosett force-pushed the codex/audit-sdk-symbol-names branch from d3fdb88 to b7a6e9d Compare October 23, 2026 06:26
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 5540852 into boykopovar:main Oct 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants