feat(libSceAjm.native): check the three driver queries' arguments #14226

Merged
zaryabzip merged 4 commits from upstream-pr/14226 into main 2026-11-06 16:52:07 +00:00
zaryabzip commented 2026-11-01 00:53:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-11-01T00:53:58Z.


What

sceAjmInstanceGetSize, sceAjmGetFailedInstance and sceAjmTelemetryGetLog get their argument lists and checks in libSceAjm.native. This follows @BunnyFl's firmware 13.42 run and disassembly: the module ran under an emulator after its own sceAjmInitialize, with imports stubbed, not on a console. Argument types are inferred from register use.

Which module. In 13.42 only libSceAjm.native.sprx exports the three. libSceAjm.sprx exports 22 functions and none of these NIDs. sceAjmInitialize's NID, the control, is in both. On main they were throwing stubs in libSceAjm's own Export.cpp. The implementations live in a new src/DriverQueries.cpp, which only libSceAjm.native compiles. The pinned 13.60 inventory lists all three as defined exports of libSceAjm, and that module wasn't checked, so libSceAjm keeps them as throwing placeholders. They are named …_nid_disambig1, which keeps their NIDs: the convention check doesn't allow the same name in two libraries. libSceAjm's debt entry scopes the native-only finding to 13.42.

What they do. Each checks its arguments, then sends one ioctl to /dev/ajm on the context and returns the first dword of the driver's reply. AnyPS5 has no such driver, so that part throws.

Export Refused before the driver
sceAjmInstanceGetSize(uint32_t context, uint32_t codec, uint64_t flags) 0x8093000C when (flags & 0x380) >= 0x180, (flags & 0x2400) == 0x2000, or any bit in 0xf0000000ffffc000 is set. The run rejected 0x180, 0x380, 0x2000, 0x4000, 0x8000 and 1 << 60, and passed 0, 0x80, 0x17f, 0x400 and 0x2400. codec isn't checked
sceAjmGetFailedInstance(uint32_t context, void* failed) a null output: 0x80930005
sceAjmTelemetryGetLog(uint32_t context, uint8_t* flag, void* log) a null log: 0x80930005; flag isn't checked

The module reads no size table and no failure or log state of its own. So the sizes, failed instances and logs aren't modelled here. Neither is the mapping of a failed ioctl (errno 9, 13, 19, 22 or 25 to 0x80930002, others to 0x80930001), because contexts aren't validated anywhere in this library. libSceAjm.native gains three functions.

Test. The new GuestAjmDriverQueries.cpp resolves the three by name from libSceAjm.native, so on main it builds and aborts because they aren't exported there. It checks every rejected flag combination for three codecs, and the null rejections, without calling a valid path, since that reaches the driver.

Overlap: git merge-tree merges this cleanly with main and every open pull request that merges with main.

Tested

Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), with the head 803d608419 merged into main cae3edaf11.

  • No warnings in the changed files. Every file that includes either Api.hpp rebuilds with no warnings, and so does each header compiled on its own.
  • Export tables of the unpatched builds: libSceAjm.native.prx exports the three; libSceAjm.prx exports none of them. Since fbb68ec459, libSceAjm.prx exports the three _nid_disambig1 placeholders, and both NID-patched modules export Ct3WeO240lw, QeaZORfh9GA and Wxcje0U9LNE. At that head, on main 5bae1a4bc2, the six (Windows) and seven (WSL2) guest_ajm*/guest_offline_imports tests pass, with no warnings in the changed files.
  • ctest -R "guest_ajm|atrac9|ngs2|guest_offline_imports": 54 of 54 pass on Windows and 55 of 55 on WSL2 (guest_ajm_teardown is registered off Windows only). guest_ajm_driver_queries passes 3 of 3 on --repeat until-fail:3.
  • Baseline: on that main with only the new test file and its CMakeLists.txt lines, the test aborts with sceAjmInstanceGetSize is not exported by libSceAjm.native (Windows exit 0xc0000409, Linux SIGABRT).
  • tools/check_conventions.py passes.

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: Fixes #13805
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5103092368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14226). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-11-01T00:53:58Z. --- ### What `sceAjmInstanceGetSize`, `sceAjmGetFailedInstance` and `sceAjmTelemetryGetLog` get their argument lists and checks in libSceAjm.native. This follows @BunnyFl's [firmware 13.42 run and disassembly](https://github.com/boykopovar/AnyPS5/issues/13805#issuecomment-6543803709): the module ran under an emulator after its own `sceAjmInitialize`, with imports stubbed, not on a console. Argument types are inferred from register use. **Which module.** In 13.42 only `libSceAjm.native.sprx` exports the three. `libSceAjm.sprx` exports 22 functions and none of these NIDs. `sceAjmInitialize`'s NID, the control, is in both. On `main` they were throwing stubs in libSceAjm's own `Export.cpp`. The implementations live in a new `src/DriverQueries.cpp`, which only libSceAjm.native compiles. The pinned 13.60 inventory lists all three as defined exports of libSceAjm, and that module wasn't checked, so libSceAjm keeps them as throwing placeholders. They are named `…_nid_disambig1`, which keeps their NIDs: the convention check doesn't allow the same name in two libraries. libSceAjm's debt entry scopes the native-only finding to 13.42. **What they do.** Each checks its arguments, then sends one `ioctl` to `/dev/ajm` on the context and returns the first dword of the driver's reply. AnyPS5 has no such driver, so that part throws. | Export | Refused before the driver | |---|---| | `sceAjmInstanceGetSize(uint32_t context, uint32_t codec, uint64_t flags)` | `0x8093000C` when `(flags & 0x380) >= 0x180`, `(flags & 0x2400) == 0x2000`, or any bit in `0xf0000000ffffc000` is set. The run rejected 0x180, 0x380, 0x2000, 0x4000, 0x8000 and `1 << 60`, and passed 0, 0x80, 0x17f, 0x400 and 0x2400. `codec` isn't checked | | `sceAjmGetFailedInstance(uint32_t context, void* failed)` | a null output: `0x80930005` | | `sceAjmTelemetryGetLog(uint32_t context, uint8_t* flag, void* log)` | a null `log`: `0x80930005`; `flag` isn't checked | The module reads no size table and no failure or log state of its own. So the sizes, failed instances and logs aren't modelled here. Neither is the mapping of a failed `ioctl` (errno 9, 13, 19, 22 or 25 to `0x80930002`, others to `0x80930001`), because contexts aren't validated anywhere in this library. libSceAjm.native gains three functions. **Test.** The new `GuestAjmDriverQueries.cpp` resolves the three by name from libSceAjm.native, so on `main` it builds and aborts because they aren't exported there. It checks every rejected flag combination for three codecs, and the null rejections, without calling a valid path, since that reaches the driver. Overlap: `git merge-tree` merges this cleanly with `main` and every open pull request that merges with `main`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), with the head 803d608419 merged into `main` cae3edaf11. - No warnings in the changed files. Every file that includes either `Api.hpp` rebuilds with no warnings, and so does each header compiled on its own. - Export tables of the unpatched builds: `libSceAjm.native.prx` exports the three; `libSceAjm.prx` exports none of them. Since fbb68ec459, `libSceAjm.prx` exports the three `_nid_disambig1` placeholders, and both NID-patched modules export `Ct3WeO240lw`, `QeaZORfh9GA` and `Wxcje0U9LNE`. At that head, on `main` 5bae1a4bc2, the six (Windows) and seven (WSL2) `guest_ajm*`/`guest_offline_imports` tests pass, with no warnings in the changed files. - `ctest -R "guest_ajm|atrac9|ngs2|guest_offline_imports"`: 54 of 54 pass on Windows and 55 of 55 on WSL2 (`guest_ajm_teardown` is registered off Windows only). `guest_ajm_driver_queries` passes 3 of 3 on `--repeat until-fail:3`. - Baseline: on that `main` with only the new test file and its `CMakeLists.txt` lines, the test aborts with `sceAjmInstanceGetSize is not exported by libSceAjm.native` (Windows exit 0xc0000409, Linux SIGABRT). - `tools/check_conventions.py` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> Fixes #13805 - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes (Claude Code)
MarcZX10 commented 2026-11-01 00:57:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T00:57:25Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The exact head 803d608419b345fc4556b05a2c2d0507decdd471 has two blocking issues: it removes exports recorded for firmware 13.60, and the repository convention check fails on the debt entry.

What I ran

Reviewed head 803d608419b345fc4556b05a2c2d0507decdd471 against base ca96807e83496557fed7cc8ea4d2261bc7a5d7c3 (main); the exact-head merge preview was clean. Environment: Linux x86_64, glibc 2.36, Python 3.11.2, GCC 12.2.0. No build or C++ tests were run locally.

git diff --check ca96807e83496557fed7cc8ea4d2261bc7a5d7c3...803d608419b345fc4556b05a2c2d0507decdd471
python3 tools/check_conventions.py --base ca96807e83496557fed7cc8ea4d2261bc7a5d7c3 --head 803d608419b345fc4556b05a2c2d0507decdd471 --title "feat(libSceAjm.native): check the three driver queries' arguments and export them from the native module only" --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14226-803d608419b3/pr-body.md
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base ca96807e83496557fed7cc8ea4d2261bc7a5d7c3 --head 803d608419b345fc4556b05a2c2d0507decdd471
python3 tools/pr_stack_check.py 14226 --repo boykopovar/AnyPS5
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr14226-quality core/libs/tests/GuestAjmDriverQueries.cpp
gh pr checks 14226 -R boykopovar/AnyPS5

I also inspected the full PR diff, test registration, debt files, the PR's linked 13.42 report, and the pinned 13.60 export inventory. The local C++ test binary was not built.

Results

Check Result
git diff --check Passed; no whitespace errors.
Repository conventions and PR template Failed: the modified docs/dev/debt/libSceAjm.md entry points to libSceAjm.native, so it belongs in that library's debt file; the same topic is already recorded there.
Export/NID audit Passed lexically; declarations and definitions for the three native exports match their computed NIDs. This does not verify firmware-version module placement or runtime ABI.
Current-base merge preview Clean against ca96807e83496557fed7cc8ea4d2261bc7a5d7c3; no declared PR dependencies.
Test-quality heuristic Warning is a false positive on registration: the CMake file registers guest_ajm_driver_queries using ${LIBS_INCLUDE_DIR}/tests/GuestAjmDriverQueries.cpp, so the literal-path heuristic does not match it. Manual inspection confirms registration.
Hosted CI All six jobs were still pending at the final refresh: conventions, eligibility, intake, labels, library-portability, and report.
Local C++ tests/build Not run; the current reviewer workflow excludes builds on the initial review.
Unedited outputs for the relevant checks

git diff --check produced no output and exited successfully.

Conventions check:

docs/dev/debt/libSceAjm.md:5: error: [debt-file] Technical debt about one library or component goes in docs/dev/debt/<name>.md, named after the first core/ path it links: <library> for core/libs/prx/<library>, otherwise <component> for core/<component>; entries that link neither stay in docs/dev/TechnicalDebt.md: docs/dev/debt/libSceAjm.native.md
1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all

ABI audit output for the changed symbols:

ABI audit: passed
sceAjmGetFailedInstance: NID=Ct3WeO240lw declarations=1 definitions=1 aliases=0
sceAjmInstanceGetSize: NID=QeaZORfh9GA declarations=1 definitions=1 aliases=0
sceAjmTelemetryGetLog: NID=Wxcje0U9LNE declarations=1 definitions=1 aliases=0
limit: This lexical audit does not parse C++ fully, prove calling-convention or binary ABI correctness, verify runtime version tables, or replace compilation.

Test-quality heuristic output:

core/libs/tests/GuestAjmDriverQueries.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.

Hosted check snapshot:

conventions	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258759711/job/124707464010
eligibility	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258759922/job/124707463516
intake	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258759848/job/124707464087
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258759842/job/124707464204
library-portability	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258760033/job/124707463330
report	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41258759908/job/124707463045

Negative control

Assertion Mutation or baseline used Result
The new test fails when the implementations are absent Not independently run locally; the PR description reports a baseline-only run where the test aborts because the native module lacks sceAjmInstanceGetSize. Author-reported only; not independently verified.

Findings

Blocking

  1. Preserve the 13.60 module exports. This patch removes all three functions from libSceAjm and adds them only to libSceAjm.native. The pinned 13.60 inventory records sceAjmGetFailedInstance, sceAjmInstanceGetSize, and sceAjmTelemetryGetLog as defined exports of libSceAjm; the PR's linked measurement establishes the native-only placement for 13.42 and explicitly says 13.60 was not checked. Applying the same module move globally therefore drops the recorded 13.60 import surface. Please preserve the correct module mapping for both firmware inventories, or provide evidence and version-aware export handling that makes the removal safe.
  2. Fix the debt-file convention failure. docs/dev/debt/libSceAjm.md:5 now describes exports from libSceAjm.native and links into that PRX, while the same finding is documented in docs/dev/debt/libSceAjm.native.md. Remove or relocate the stale entry from libSceAjm.md so tools/check_conventions.py passes.

Non-blocking

  • I did not independently run the author's Windows or WSL test commands. Hosted CI was pending at the final refresh.

Sources

Not verified

  • No local build or C++ tests were run.
  • The reported Windows and WSL test results and baseline negative control were not independently reproduced.
  • Console behavior and driver responses were not tested.
  • Hosted CI had not completed at the final refresh.

To get this to a good state

Please retain the correct libSceAjm exports for the 13.60 inventory and remove or relocate the misplaced duplicate debt entry. I will rerun the same checks against the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5725783123 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14226#pullrequestreview-5725783123). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T00:57:25Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The exact head `803d608419b345fc4556b05a2c2d0507decdd471` has two blocking issues: it removes exports recorded for firmware 13.60, and the repository convention check fails on the debt entry. ## What I ran Reviewed head `803d608419b345fc4556b05a2c2d0507decdd471` against base `ca96807e83496557fed7cc8ea4d2261bc7a5d7c3` (`main`); the exact-head merge preview was clean. Environment: Linux x86_64, glibc 2.36, Python 3.11.2, GCC 12.2.0. No build or C++ tests were run locally. ```sh git diff --check ca96807e83496557fed7cc8ea4d2261bc7a5d7c3...803d608419b345fc4556b05a2c2d0507decdd471 python3 tools/check_conventions.py --base ca96807e83496557fed7cc8ea4d2261bc7a5d7c3 --head 803d608419b345fc4556b05a2c2d0507decdd471 --title "feat(libSceAjm.native): check the three driver queries' arguments and export them from the native module only" --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14226-803d608419b3/pr-body.md python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base ca96807e83496557fed7cc8ea4d2261bc7a5d7c3 --head 803d608419b345fc4556b05a2c2d0507decdd471 python3 tools/pr_stack_check.py 14226 --repo boykopovar/AnyPS5 python3 tools/pr_test_quality.py --root /tmp/anyps5-pr14226-quality core/libs/tests/GuestAjmDriverQueries.cpp gh pr checks 14226 -R boykopovar/AnyPS5 ``` I also inspected the full PR diff, test registration, debt files, the PR's linked 13.42 report, and the pinned 13.60 export inventory. The local C++ test binary was not built. ## Results | Check | Result | |---|---| | `git diff --check` | Passed; no whitespace errors. | | Repository conventions and PR template | Failed: the modified `docs/dev/debt/libSceAjm.md` entry points to `libSceAjm.native`, so it belongs in that library's debt file; the same topic is already recorded there. | | Export/NID audit | Passed lexically; declarations and definitions for the three native exports match their computed NIDs. This does not verify firmware-version module placement or runtime ABI. | | Current-base merge preview | Clean against `ca96807e83496557fed7cc8ea4d2261bc7a5d7c3`; no declared PR dependencies. | | Test-quality heuristic | Warning is a false positive on registration: the CMake file registers `guest_ajm_driver_queries` using `${LIBS_INCLUDE_DIR}/tests/GuestAjmDriverQueries.cpp`, so the literal-path heuristic does not match it. Manual inspection confirms registration. | | Hosted CI | All six jobs were still pending at the final refresh: conventions, eligibility, intake, labels, library-portability, and report. | | Local C++ tests/build | Not run; the current reviewer workflow excludes builds on the initial review. | <details><summary>Unedited outputs for the relevant checks</summary> `git diff --check` produced no output and exited successfully. Conventions check: ```text docs/dev/debt/libSceAjm.md:5: error: [debt-file] Technical debt about one library or component goes in docs/dev/debt/<name>.md, named after the first core/ path it links: <library> for core/libs/prx/<library>, otherwise <component> for core/<component>; entries that link neither stay in docs/dev/TechnicalDebt.md: docs/dev/debt/libSceAjm.native.md 1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` ABI audit output for the changed symbols: ```text ABI audit: passed sceAjmGetFailedInstance: NID=Ct3WeO240lw declarations=1 definitions=1 aliases=0 sceAjmInstanceGetSize: NID=QeaZORfh9GA declarations=1 definitions=1 aliases=0 sceAjmTelemetryGetLog: NID=Wxcje0U9LNE declarations=1 definitions=1 aliases=0 limit: This lexical audit does not parse C++ fully, prove calling-convention or binary ABI correctness, verify runtime version tables, or replace compilation. ``` Test-quality heuristic output: ```text core/libs/tests/GuestAjmDriverQueries.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage. Heuristic findings require manual interpretation. ``` Hosted check snapshot: ```text conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258759711/job/124707464010 eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258759922/job/124707463516 intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258759848/job/124707464087 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258759842/job/124707464204 library-portability pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258760033/job/124707463330 report pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258759908/job/124707463045 ``` </details> ## Negative control | Assertion | Mutation or baseline used | Result | |---|---|---| | The new test fails when the implementations are absent | Not independently run locally; the PR description reports a baseline-only run where the test aborts because the native module lacks `sceAjmInstanceGetSize`. | Author-reported only; not independently verified. | ## Findings ### Blocking 1. **Preserve the 13.60 module exports.** This patch removes all three functions from `libSceAjm` and adds them only to `libSceAjm.native`. The pinned 13.60 inventory records `sceAjmGetFailedInstance`, `sceAjmInstanceGetSize`, and `sceAjmTelemetryGetLog` as defined exports of `libSceAjm`; the PR's linked measurement establishes the native-only placement for 13.42 and explicitly says 13.60 was not checked. Applying the same module move globally therefore drops the recorded 13.60 import surface. Please preserve the correct module mapping for both firmware inventories, or provide evidence and version-aware export handling that makes the removal safe. 2. **Fix the debt-file convention failure.** `docs/dev/debt/libSceAjm.md:5` now describes exports from `libSceAjm.native` and links into that PRX, while the same finding is documented in `docs/dev/debt/libSceAjm.native.md`. Remove or relocate the stale entry from `libSceAjm.md` so `tools/check_conventions.py` passes. ### Non-blocking - I did not independently run the author's Windows or WSL test commands. Hosted CI was pending at the final refresh. ## Sources - [PR changes at the reviewed commit](https://github.com/boykopovar/AnyPS5/commit/803d608419b345fc4556b05a2c2d0507decdd471), including the module move and native implementation. - [Firmware 13.60 export inventory at commit `bfec40deb4c47a17d7603ee2bc79aa6862c0c56b`](https://github.com/xdCloudy/PS5-13.60-Function-Stub-Library/blob/bfec40deb4c47a17d7603ee2bc79aa6862c0c56b/data/firmware-13.60/libsceajm-5217837f40.jsonl#L13), [#L26](https://github.com/xdCloudy/PS5-13.60-Function-Stub-Library/blob/bfec40deb4c47a17d7603ee2bc79aa6862c0c56b/data/firmware-13.60/libsceajm-5217837f40.jsonl#L26), and [#L34](https://github.com/xdCloudy/PS5-13.60-Function-Stub-Library/blob/bfec40deb4c47a17d7603ee2bc79aa6862c0c56b/data/firmware-13.60/libsceajm-5217837f40.jsonl#L34). - [The 13.42 run/disassembly report cited by the PR](https://github.com/boykopovar/AnyPS5/issues/13805#issuecomment-6543803709) says it did not check the 13.60 module files. - [Repository conventions at base commit `ca96807e83496557fed7cc8ea4d2261bc7a5d7c3`](https://github.com/boykopovar/AnyPS5/blob/ca96807e83496557fed7cc8ea4d2261bc7a5d7c3/docs/dev/CONVENTIONS.md). ## Not verified - No local build or C++ tests were run. - The reported Windows and WSL test results and baseline negative control were not independently reproduced. - Console behavior and driver responses were not tested. - Hosted CI had not completed at the final refresh. ## To get this to a good state Please retain the correct `libSceAjm` exports for the 13.60 inventory and remove or relocate the misplaced duplicate debt entry. I will rerun the same checks against the new head.
BunnyFl commented 2026-11-03 15:10:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T15:10:32Z.

Review: APPROVED


Approving at fbb68ec459. I re-read the three 13.42 bodies instead of relying on my earlier note, and both of MarcZX10's blocking points from the review of 803d608419 look addressed. @MarcZX10, for your re-review.

Firmware 13.42 (system/common/lib/libSceAjm.native.sprx, sha256 8eea270172e7ea177e69fa7865493b72131670f87afa91798d7d749ac183d5c0; read from disassembly, not run on a console):

  • sceAjmInstanceGetSize (QeaZORfh9GA):
    addr: 0xd4e
    d4e: and $0x380,%ecx ; d54: and $0x2400,%edi ; d5a: cmp $0x180,%ecx ; cmovae 0x8093000c
    d68: cmp $0x2000,%edi ; cmove 0x8093000c
    d76: movabs $0xf0000000ffffc000,%rax ; d80: test %rax,%rdx ; cmovne 0x8093000c
    
    On a negative result it returns before the driver (js at 0xd8a). Otherwise it sends ioctl 0xc028890d on the context (0xd90) and returns the reply's first dword (0xdaa). DriverQueries.cpp has the same three conditions in the same form.
  • sceAjmGetFailedInstance (Ct3WeO240lw): test %rsi,%rsi at 0x1393, so a null second argument gives 0x80930005 (0x13b8) before ioctl 0xc0288965.
  • sceAjmTelemetryGetLog (Wxcje0U9LNE): only the third argument is tested (test %rdx,%rdx at 0x1479, null gives 0x80930005). After a successful ioctl 0xc0288990 it stores a byte through the second argument without a null check (mov %al,(%rbx) at 0x149d). That matches the debt entry's "flag isn't checked" and the PR's test, which expects flag untouched on the null-log path.
  • In 13.42 the three NIDs are defined only in libSceAjm.native.sprx, not in libSceAjm.sprx or libSceAjmi.sprx (objdump -T, defined entries).

MarcZX10's points:

  1. 13.60 export surface: after building this head merged onto main, both patched modules export Ct3WeO240lw, QeaZORfh9GA and Wxcje0U9LNE. libSceAjm.prx exports them through the _nid_disambig1 placeholders; libSceAjm.native.prx exports the checked implementations.
  2. Conventions: tools/check_conventions.py --base upstream/main on the merge: "All conventions checks passed."

What I ran (Windows 11, WinLibs GCC 15.2.0, Release, this head merged onto upstream/main 4f41f4c375): guest_ajm*, ajm* and atrac9* tests, 7 of 7 pass, including the new guest_ajm_driver_queries.

Mutation checks on the merge, one at a time, rebuilding each time. Each mutant makes the new test fail; the failure output names the throwing driver path (what(): <function>: the request to the AJM driver):

  • (flags & 0x380u) >= 0x180u changed to >= 0x380u;
  • if (!failed) return changed to if (false) return;
  • if (!log) return changed to if (false) return.

No negative control on main: the test resolves the three names from libSceAjm.native, which doesn't export them there.

Non-blocking, for whoever takes the next step: the same module defines one more query of this shape, KWoxiB9bVmA. Its NID is the hash of sceAjmTelemetryClearLog. Its 13.42 body at 0x1520 takes only the context, sends ioctl 0xc0288991, and returns the reply's first dword, with the same errno mapping as these three (0x1550-0x15aa). It's not declared in the repo; I'll leave it out of this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5754611549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14226#pullrequestreview-5754611549). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T15:10:32Z. **Review:** APPROVED --- Approving at `fbb68ec459`. I re-read the three 13.42 bodies instead of relying on my earlier note, and both of MarcZX10's blocking points from the review of `803d608419` look addressed. @MarcZX10, for your re-review. **Firmware 13.42** (`system/common/lib/libSceAjm.native.sprx`, sha256 `8eea270172e7ea177e69fa7865493b72131670f87afa91798d7d749ac183d5c0`; read from disassembly, not run on a console): - `sceAjmInstanceGetSize` (`QeaZORfh9GA`): ``` addr: 0xd4e d4e: and $0x380,%ecx ; d54: and $0x2400,%edi ; d5a: cmp $0x180,%ecx ; cmovae 0x8093000c d68: cmp $0x2000,%edi ; cmove 0x8093000c d76: movabs $0xf0000000ffffc000,%rax ; d80: test %rax,%rdx ; cmovne 0x8093000c ``` On a negative result it returns before the driver (`js` at `0xd8a`). Otherwise it sends ioctl `0xc028890d` on the context (`0xd90`) and returns the reply's first dword (`0xdaa`). `DriverQueries.cpp` has the same three conditions in the same form. - `sceAjmGetFailedInstance` (`Ct3WeO240lw`): `test %rsi,%rsi` at `0x1393`, so a null second argument gives `0x80930005` (`0x13b8`) before ioctl `0xc0288965`. - `sceAjmTelemetryGetLog` (`Wxcje0U9LNE`): only the third argument is tested (`test %rdx,%rdx` at `0x1479`, null gives `0x80930005`). After a successful ioctl `0xc0288990` it stores a byte through the second argument without a null check (`mov %al,(%rbx)` at `0x149d`). That matches the debt entry's "`flag` isn't checked" and the PR's test, which expects `flag` untouched on the null-log path. - In 13.42 the three NIDs are defined only in `libSceAjm.native.sprx`, not in `libSceAjm.sprx` or `libSceAjmi.sprx` (`objdump -T`, defined entries). **MarcZX10's points:** 1. **13.60 export surface:** after building this head merged onto `main`, both patched modules export `Ct3WeO240lw`, `QeaZORfh9GA` and `Wxcje0U9LNE`. `libSceAjm.prx` exports them through the `_nid_disambig1` placeholders; `libSceAjm.native.prx` exports the checked implementations. 2. **Conventions:** `tools/check_conventions.py --base upstream/main` on the merge: "All conventions checks passed." **What I ran** (Windows 11, WinLibs GCC 15.2.0, Release, this head merged onto `upstream/main` `4f41f4c375`): `guest_ajm*`, `ajm*` and `atrac9*` tests, 7 of 7 pass, including the new `guest_ajm_driver_queries`. **Mutation checks** on the merge, one at a time, rebuilding each time. Each mutant makes the new test fail; the failure output names the throwing driver path (`what(): <function>: the request to the AJM driver`): - `(flags & 0x380u) >= 0x180u` changed to `>= 0x380u`; - `if (!failed) return` changed to `if (false) return`; - `if (!log) return` changed to `if (false) return`. No negative control on `main`: the test resolves the three names from `libSceAjm.native`, which doesn't export them there. Non-blocking, for whoever takes the next step: the same module defines one more query of this shape, `KWoxiB9bVmA`. Its NID is the hash of `sceAjmTelemetryClearLog`. Its 13.42 body at `0x1520` takes only the context, sends ioctl `0xc0288991`, and returns the reply's first dword, with the same errno mapping as these three (`0x1550-0x15aa`). It's not declared in the repo; I'll leave it out of this PR.
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!14226
No description provided.