fix(libSceAjm): check batch job buffer counts before the 8-bit cast #15321
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15321"
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 MarcZX10 on 2026-11-02T23:56:16Z.
What
sceAjmBatchJobbuffer counts were truncated to 8 bits before the range check inJobRejected. A count that wraps past 32 bits (for example2^32 + 1) passed as a small valid value. The count is now checked at full width, and counts that do not fit are refused.Commits:
96e2a7e576fix(libSceAjm): check batch job buffer counts before the 8-bit cast9b20e4eb70test(libSceAjm): refuse batch job buffer counts that wrap past 32 bitsTested
main).ctest -R '^guest_ajm$': 1 of 1 passed (guest_ajm, Test #2204).tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main: clean.Not verified
INVALID_PARAMETER) follows the existing range check; the console value is not measured.Checklist
main; no other open PR changes this checkImported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T15:22:49Z.
Review: APPROVED
Reviewed — approved
The new guard in
sceAjmBatchJobRunSplitchecks thesize_tbuffer counts before they are narrowed. This stops counts such as2^32 + 1from wrapping to a small valid value. The new test catches the bug onmain.What I ran
9b20e4eb70ceafbba4921cd6d776e54f7f91f236merged with--no-ffintomain4f41f4c375f5abb487dbd184fbc150f31994d762(merged tree94ecc44b8c349ffa6a6d8b4b45849d566ec13200).Results
git diff --checkcheck_conventions.pylibs(script)unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group: it also fails onmainand is not related to this PRguest_ajm(merged tree)guest_ajmwithAjm.cppfrommainguest_ajmafter restoring the merged filegit status --porcelainemptyNegative control
I put only
core/libs/prx/libSceAjm.native/src/Ajm.cppback tomain, kept the PR's test and rebuilt.guest_ajmthen aborted. With the merged file restored, it passes. This confirms the Windows results that bunbeans2-arch and BunnyFl reported, now on Linux/GCC 14.Findings
Blocking
None.
Non-blocking
The 0xff refusal differs from the console and is not recorded as debt. I checked BunnyFl's point:
JobRejectedrefuses counts above0xffbecause of the host's 8-bit packed job.docs/dev/debt/libSceAjm.native.mdhas no entry for this limit.core/libs/prx/libSceAjm.native/src/Ajm.cpp:2067) extends the same refusal to counts above 32 bits. Per BunnyFl's disassembly of 13.42, the console returns0x80930012in that case when the sideband is valid.The PR returns a refusal where
mainsilently ran a wrong job, so this is a strict improvement. The divergence itself is older than this PR. Suggested follow-up: add a debt entry for the host's 255-buffer limit and its error code, and add a test row with an 8-byte sideband to pin the intended code.Not verified