Skip to content

fix(tools): audit ordinary homebrew import names - #6239

Open
ArjenS-LA wants to merge 1 commit into
boykopovar:mainfrom
ArjenS-LA:fix/audit-named-homebrew-imports
Open

ArjenS-LA wants to merge 1 commit into
boykopovar:mainfrom
ArjenS-LA:fix/audit-named-homebrew-imports

Conversation

@ArjenS-LA

Copy link
Copy Markdown
Contributor

What

Registries emitted from ordinary ELF homebrew use literal import names, but the audit accepted only 11-character encoded NIDs. Accept nonempty symbol names without whitespace or control characters, preserve existing qualification stripping, and look up literal exports without hashing the names. The audit continues to report unresolved imports rather than suppressing them.

Tested

Windows 11 x64 (build 26200), WinLibs MinGW-w64 GCC 15.2.0 r7, CMake 4.3.1, Ninja 1.13.2, Python 3.13.7. Baseline: d92a8dad390af1807cc91622b924252141816a5a. Branch: fix/audit-named-homebrew-imports. Commit: f9f6872b8d293ee0353e2f2dd95c49840da209ad. Committed-object conventions check passed.

The same named-import regression fails on unchanged main (invalid NID 'strcmp') and passes fixed. The audit suite has 77 passes, three platform/privilege skips, and one excluded fixture that creates a temporary Git commit. Coverage includes literal exports, mangled names, encoded NIDs, duplicate references, unresolved weak imports, and rejection of empty/control-character names.

Homebrew evidence

Used the unchanged main and module registries generated by the current-main relinker from the real Mari0 bundle, with --windows --registry --trap-sdk-syscall-stubs --module-dir . and an added empty sce_module directory. This is an indirect diagnostic workflow; it does not depend on the explicit-directory fix.

python tools/import_audit.py output.registry.json output.libOSMesa.so.8.guest.prx.registry.json --libs $officialPrx --source $baselineSource --json audit.json

Baseline: exit 2 at the first strcmp record, without an audit report. Fixed: exit 1 with a complete report of 561 references and 376 unique imports. All 376 remain absent against the supplied official v0.1.2 libraries, and ten .sprx dependencies remain missing; this fix enables diagnosis, not successful loading. The 126 official patched .prx inputs were read from the v0.1.2 release, not newly built. No library was executed.

Package: Mari0 1.6.2 from websrv v0.34. Original layout and input hashes were checked before and after conversion; all inputs remained unchanged.

Input SHA-256
Mari0.zip e0331ed5a22e7fe72843d268cd2c8b297d761a75b7c83d828f5cc58a82a72ce3
love.elf 54bcc91670fd759bbd3488284dce351b6421cb83016e9ad8da6b5186da067a39
libOSMesa.so.8 128d2ab20b980b96decb1f20a9ed57d10cc922605259666b63efa52963920f0a

No generated homebrew executable was run. No game startup, gameplay, GPU, commercial-title, or physical-PS5 result is claimed.

Baseline relinker SHA-256: a249e5a38abe9f338f09d6ea09182b5a39cd156dada6771984b85e315fda67c5. Tested registry-producing relinker SHA-256: a249e5a38abe9f338f09d6ea09182b5a39cd156dada6771984b85e315fda67c5.

Official v0.1.2 PRX archive SHA-256: b26e507e7cc01922312f4ca9c7b36ab333ed3a1d7048d676f20214cadf2d4895.

Local logs, exact argv, per-file hashes, source patches, before/after failures and JSON results: C:/Users/arjen/AppData/Local/Temp/anyps5-three-homebrew-20261014 (homebrew-report.json, regression logs and CTest logs). The commands and decisive results are included above so this report does not depend on access to that local folder.

Open PR comparison

Complete paginated inventory: 543 open PRs; main d92a8dad390af1807cc91622b924252141816a5a. Complete changed-file lists and tree-only merge previews used that main as the explicit common base. This change merges with main and both other proposed changes. 18 relevant comparisons merge cleanly; 23 remain inconclusive because the other PR already conflicts with main. No conflict-free claim is made for those PRs.

Exact compared heads and shared-file results
PR Head Shared paths Result
#6231 1800d3892bec857b254ca8c55e912e325e1c6711 docs/user/USAGE.md clean
#6190 09afe38730d7b9d40d57b8aa9e13777012d170a3 docs/user/USAGE.md clean
#6171 657f16ea286035a8615e2d56614a354cd4559e31 docs/user/USAGE.md, tools/import_audit.py, tools/tests/test_import_audit.py clean
#6113 fcd477faf8fd0b4959f927db1f36590b317fa2b7 tools/import_audit.py, tools/tests/test_import_audit.py clean
#6111 c690012ce1b6f73ab985c061509e7cbfb41127c2 docs/user/USAGE.md clean
#6012 62022e9362a27432e007cea132ecd9ca0909bb2b docs/user/USAGE.md clean
#5962 1f98703dd07a6257c84ea485594d92f5a8e84fba docs/user/USAGE.md clean
#5925 3339ddd3af77cfc336148966657c0d14e87b6ae1 docs/user/USAGE.md inconclusive: existing main conflicts
#5875 569ff84ea2589a9c886dca37b5c9ddcea70049bd docs/user/USAGE.md inconclusive: existing main conflicts
#5835 e4036135ed0823b866969e6e7e688712b0f57fcc docs/user/USAGE.md clean
#5784 9acd5dcc07d8149020bf50fbd5e09f7633a2613f docs/user/USAGE.md clean
#5713 fd3c6796042ff61c599fa100a4e979a7be200658 tools/import_audit.py, tools/tests/test_import_audit.py clean
#5695 acc228ab4a54fbdc0c816c22b52b82968e42649b docs/user/USAGE.md clean
#5582 2d14128a29ec22d25e0cb308777dd46894a73170 docs/user/USAGE.md clean
#5571 7ff22e76dc54f096f724381aef1a0c936b86cf9b tools/import_audit.py, tools/tests/test_import_audit.py clean
#5390 d4fa8367daa0fd826853f440d23c3a604af43449 docs/user/USAGE.md inconclusive: existing main conflicts
#5021 01f2073d06385ca2adb537d4996ad61e8255bd2e docs/user/USAGE.md inconclusive: existing main conflicts
#4891 ab0e383aca0fd9c8d873293ec0ffa170d750baa4 docs/user/USAGE.md inconclusive: existing main conflicts
#4855 82de94cbedc5461de6af731b2a5a9838aca66e48 docs/user/USAGE.md clean
#4847 b05e5cf8ecf4f410750c38a6f281f273babb816d docs/user/USAGE.md clean
#4813 2d6b8ef4341e21d78686bfba9da9a5c6bb14d629 docs/user/USAGE.md inconclusive: existing main conflicts
#4760 1263d7065489fd6b7a15ebbecb1fcf0ee72d21f9 docs/user/USAGE.md inconclusive: existing main conflicts
#4749 07713af3078fcb4e24a15c96bf15c3df4e2b071a docs/user/USAGE.md inconclusive: existing main conflicts
#4740 beb1ba79f2b3a2fc3882bf9d65553e4e754fc03d docs/user/USAGE.md inconclusive: existing main conflicts
#4718 e4b37aa2e22c15e0e07341a7d8c18100cbae55c2 docs/user/USAGE.md inconclusive: existing main conflicts
#4599 8c49e6d6960021ef72e1382d78b9b83914cc7f31 docs/user/USAGE.md inconclusive: existing main conflicts
#4566 16b602cbfb29dcf3fc89b4ed67f228d65a27b20b docs/user/USAGE.md inconclusive: existing main conflicts
#4523 66c8f11a47d64c2db6f514e409e94e91f5ac5309 docs/user/USAGE.md inconclusive: existing main conflicts
#4522 92b12559c64489b556179b651ab4d966c29314ec docs/user/USAGE.md inconclusive: existing main conflicts
#4521 67f9e72d1c663dbc8811cdb6c85753844be02381 docs/user/USAGE.md inconclusive: existing main conflicts
#4520 b339b4f6ca25b1b274555394e73a26f8c8d98347 docs/user/USAGE.md inconclusive: existing main conflicts
#4424 b447062d71dc1748d60edfdc0ec437aa597a5b7d docs/user/USAGE.md inconclusive: existing main conflicts
#4423 bad53434ecca2bf92ee67c43952598c6a108941e docs/user/USAGE.md inconclusive: existing main conflicts
#4422 f9b136024e27d1463a70edee4952553628e5f289 docs/user/USAGE.md inconclusive: existing main conflicts
#4397 5e296b79d94a6312c385890352d7f76e9a0d4380 docs/user/USAGE.md inconclusive: existing main conflicts
#4396 eb34b754de4b65b11c1f7d9beafe58a0d057c45d docs/user/USAGE.md inconclusive: existing main conflicts
#4156 a6cb0cb5f277da258a661bb11792e04941f4c790 docs/user/USAGE.md inconclusive: existing main conflicts
#3998 48bc3322b68ee855d9188f4eefd701e8007dd21b docs/user/USAGE.md clean
#3994 2636a486c2f71d880b69cadb706eac719f9cc670 docs/user/USAGE.md clean
#3891 67f94df827623df9210738a5ba3275b9a59f1c8b docs/user/USAGE.md inconclusive: existing main conflicts
#3786 7b75adc8685edbffaa771e0d436543eaae694b8f docs/user/USAGE.md clean

Source comparisons: #6171 handles module aliases, #6113 normalizes exported names, #5713 preserves Git stamp data, and #5571 handles stripped section tables. None accepts literal registry import names.

Checklist

  • Based on current main; no other open PR implements the same fix (overlapping changes listed above)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (conversion/diagnostic evidence only)
  • GPUs tested: n/a
  • AI-assisted: yes (Codex)

@screamm

screamm commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Windows check of head f9f6872b8, merged onto main db81992c5: clean merge.

Windows 11 Pro 26220, Ryzen 7 5700X, RTX 4070 (driver 596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, Python 3.10/3.14.

  • ctest -R '^(import_audit|conventions_doc_links)$' --repeat until-fail:3: 2/2, 3 of 3. Run directly: Ran 81 tests, OK, 2 skipped (POSIX report permissions).
  • Negative control: this head's test_import_audit.py against main's import_audit.py fails test_named_imports_use_literal_exports_and_keep_unresolved_names with exit 2 and invalid NID. The other 8 failures there are only the renamed message.
  • tools/check_conventions.py --base origin/main and git diff --check: pass.

Three ps5-payload-dev ELFs that ship inside catalog titles, relinked with main's relinker (--windows --trap-sdk-syscall-stubs --skip-sce-module --registry) and audited against main's built libs:

Registry main main + #6239
lapy.elf (PPSA97510 PSXS5) exit 2: entry 0 has an invalid NID 'memcpy' exit 1: 39 references, 39 unique, 39 absent
sandbox-elevator.elf (PPSA74126 Stremio Plus) exit 2: entry 0 has an invalid NID 'setsockopt' exit 1: 35 references, 35 unique, 35 absent
romm-sync.elf (PPSA76677 RommPS) exit 2: entry 0 has an invalid NID '__stderrp' exit 1: 225 references, 217 unique, 217 absent

The absent lists match the loader. Each converted executable, run with main's libraries, exits 0xC0000139, and its FAIL: unresolved ELF import <name> lines name exactly the audit's absent set (39, 35 and 217 names). So the unresolved imports are still reported, and correctly.

No regression on NID registries: for PPSA99420, PPSA99002 and PPSA99082 (with --modules src/sce_module and --names), the printed reports are byte-identical on main and with this PR (674, 602 and 487 unique imports, 0 absent). The JSON differs only in source_commit.

One small note on the description: main already looked exports up by their literal names. The diff only relaxes the registry validation, so the "without hashing" part describes existing behaviour.

Verdict: confirmed. Ordinary homebrew registries now produce a complete audit instead of exit 2, and NID registries are unchanged.

AI-assisted (Claude Code).

This branch has not been deployed

No deployments
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.

2 participants