sceAjmInitialize: a retail title passes reserved = 0x300000000 and fails since #15906 #17659

Closed
opened 2026-11-09 08:02:03 +00:00 by muhmuhkuh · 0 comments
muhmuhkuh commented 2026-11-09 08:02:03 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by muhmuhkuh on 2026-11-09T08:02:03Z.


What happens

sceAjmInitialize returns INVALID_PARAMETER (0x80930005) for reserved = 0x300000000 since #15906, and the title that passes this value stops with a null write a few seconds after start.

Title, test or build step

PPSA02015 (Death Stranding 2), content version 01.015.000 (sce_sys/param.json).

AnyPS5 commit

main 0bae53facde8, which contains #15906 (merge 6daf9a1cb6d, change 7f477c4b3eb), plus local patches unrelated to Ajm.

System

Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3080 Ti (NVIDIA 610.88), MinGW-w64 GCC 15.2.0, Release.

Steps to reproduce

  1. Build AnyPS5 at or after 6daf9a1cb6d.
  2. Start PPSA02015 (retail dump) on the GPU path.
  3. The process stops a few seconds after start with exit code 0xC0000005.

By reading core/libs/prx/libSceAjm.native/src/Ajm.cpp: since #15906, sceAjmInitialize returns 0x80930005 for any nonzero reserved, and the title's audio initialization calls it as sceAjmInitialize(0x300000000, ctx) with a valid ctx (movabs $0x300000000,%rdi in the title's executable). Before #15906 the argument was ignored.

Log

The process log has no line for the sceAjmInitialize return. The return value and the call come from reading the title's executable and Ajm.cpp, not from the log. The lines around the stop (one line of the PRX list, then the crash block; paths shortened):

Loading PRX: <runtime>\libSceAjm.native.prx -> OK
FATAL: unhandled exception 0xc0000005 on thread 3716 'Main'
  rip 0x0000000001d62638 DS2.exe+0x1972638
  write of 0x00000000000000b4
  rax deadbeefcafebabe rbx 0000000000000000 rcx 0000000000000014 rdx 0000000000000010
  rsi 0000000000000030 rdi 00007ffcaf52b0b0 rbp 000000fc0a80e6e0 rsp 000000fc0a80e6a0
  r12 00000000000000b4 r13 000000000000001b r14 0000000000000010 r15 0000000000000000
  frame pointer chain:
    #0 0x0000000000b0c576 DS2.exe+0x71c576
    #1 0x00000000021aed40 DS2.exe+0x1dbed40
    #2 0x0000000001b79db3 DS2.exe+0x1789db3
    #3 0x0000000001b73812 DS2.exe+0x1783812
    #4 0x0000000001f41f60 DS2.exe+0x1b51f60
    #5 0x00007ffcca5a1910 libkernel.prx+0x81910

What was checked

How the crash follows from the return value (read statically in the title's executable):

  • The faulting instruction is lock incl 0xb4(%r15) with r15 = 0, in an allocator function that the caller (frame #0 below) calls on a global pointer that is still null.
  • The only code that sets that pointer runs after the audio initialization returned success. That initialization calls sceAudioOut2Initialize, sceSysmoduleLoadModule(0x10b), then the call above, then sceAcmContextCreate. With 0x80930005 from sceAjmInitialize it returns failure, the pointer stays null, and the next allocation through it writes to address 0xb4.

Runs: two later runs with libSceAjm.native from before #15906 passed the point where the first run stopped (one of them was stopped by the run harness afterwards, the other kept running). Their libkernel builds differ from the crashing run's, so these two runs alone do not isolate libSceAjm.native. A later build of the same source with Ajm.cpp reverted to its state before #15906 (the other changes are test fixes and profiling output in the graphics driver) has since started the title many times without this stop.

Two other candidates were checked and ruled out:

  1. The newer sceKernelLoadStartModule (flags != 0 or opt != nullptr returns EINVAL, 5ee657294bf): the title's call sites (two for sceKernelLoadStartModule, one for sceKernelStopUnloadModule) pass flags 0 and opt 0, and its guest modules do not import the call.
  2. The delayed module start in libkernel's DynamicLoader.cpp: it runs the module's start entry and constructors in the same order, in the calling thread, as the build before it, and the stopping pointer is set by the title's executable, not by module start. Judged unlikely from reading the code, not excluded by a run.

What is measured

reserved Source Console result
a stack address (lower 32 bits nonzero) obSCEne census, system software 12.40, cited in #15906 0x80930005
0x300000000 (lower 32 bits zero) retail title that runs on a PS5 accepted (implied, not probed directly)

Both points fit "only the lower 32 bits are checked", but that is a guess, and it could also be a bit mask or a range.

Proposal

  1. Measure sceAjmInitialize on a PS5 with a valid context pointer and reserved = 0, 1, 0x100000000 and 0x300000000, recording the return value and whether the context is written.
  2. Until then, keep the refusal only where it is measured, or go back to ignoring reserved. In either case, extend the sceAjmInitialize entry in docs/dev/debt/libSceAjm.native.md with the case "only the upper bits set: accepted by the console (a retail title relies on it), rule not measured".
  3. After the measurement, implement the rule it shows, with a test for each measured value.

Related: #15906.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6282264273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/17659). Originally posted by [muhmuhkuh](https://github.com/muhmuhkuh) on 2026-11-09T08:02:03Z. --- ### What happens `sceAjmInitialize` returns `INVALID_PARAMETER` (`0x80930005`) for `reserved` = `0x300000000` since #15906, and the title that passes this value stops with a null write a few seconds after start. ### Title, test or build step PPSA02015 (Death Stranding 2), content version 01.015.000 (`sce_sys/param.json`). ### AnyPS5 commit `main` `0bae53facde8`, which contains #15906 (merge `6daf9a1cb6d`, change `7f477c4b3eb`), plus local patches unrelated to Ajm. ### System Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 3080 Ti (NVIDIA 610.88), MinGW-w64 GCC 15.2.0, Release. ### Steps to reproduce 1. Build AnyPS5 at or after `6daf9a1cb6d`. 2. Start PPSA02015 (retail dump) on the GPU path. 3. The process stops a few seconds after start with exit code `0xC0000005`. By reading `core/libs/prx/libSceAjm.native/src/Ajm.cpp`: since #15906, `sceAjmInitialize` returns `0x80930005` for any nonzero `reserved`, and the title's audio initialization calls it as `sceAjmInitialize(0x300000000, ctx)` with a valid `ctx` (`movabs $0x300000000,%rdi` in the title's executable). Before #15906 the argument was ignored. ### Log The process log has no line for the `sceAjmInitialize` return. The return value and the call come from reading the title's executable and `Ajm.cpp`, not from the log. The lines around the stop (one line of the PRX list, then the crash block; paths shortened): ```text Loading PRX: <runtime>\libSceAjm.native.prx -> OK FATAL: unhandled exception 0xc0000005 on thread 3716 'Main' rip 0x0000000001d62638 DS2.exe+0x1972638 write of 0x00000000000000b4 rax deadbeefcafebabe rbx 0000000000000000 rcx 0000000000000014 rdx 0000000000000010 rsi 0000000000000030 rdi 00007ffcaf52b0b0 rbp 000000fc0a80e6e0 rsp 000000fc0a80e6a0 r12 00000000000000b4 r13 000000000000001b r14 0000000000000010 r15 0000000000000000 frame pointer chain: #0 0x0000000000b0c576 DS2.exe+0x71c576 #1 0x00000000021aed40 DS2.exe+0x1dbed40 #2 0x0000000001b79db3 DS2.exe+0x1789db3 #3 0x0000000001b73812 DS2.exe+0x1783812 #4 0x0000000001f41f60 DS2.exe+0x1b51f60 #5 0x00007ffcca5a1910 libkernel.prx+0x81910 ``` ### What was checked How the crash follows from the return value (read statically in the title's executable): - The faulting instruction is `lock incl 0xb4(%r15)` with `r15` = 0, in an allocator function that the caller (frame #0 below) calls on a global pointer that is still null. - The only code that sets that pointer runs after the audio initialization returned success. That initialization calls `sceAudioOut2Initialize`, `sceSysmoduleLoadModule(0x10b)`, then the call above, then `sceAcmContextCreate`. With `0x80930005` from `sceAjmInitialize` it returns failure, the pointer stays null, and the next allocation through it writes to address `0xb4`. Runs: two later runs with `libSceAjm.native` from before #15906 passed the point where the first run stopped (one of them was stopped by the run harness afterwards, the other kept running). Their `libkernel` builds differ from the crashing run's, so these two runs alone do not isolate `libSceAjm.native`. A later build of the same source with `Ajm.cpp` reverted to its state before #15906 (the other changes are test fixes and profiling output in the graphics driver) has since started the title many times without this stop. Two other candidates were checked and ruled out: 1. The newer `sceKernelLoadStartModule` (`flags != 0` or `opt != nullptr` returns `EINVAL`, `5ee657294bf`): the title's call sites (two for `sceKernelLoadStartModule`, one for `sceKernelStopUnloadModule`) pass `flags` 0 and `opt` 0, and its guest modules do not import the call. 2. The delayed module start in `libkernel`'s `DynamicLoader.cpp`: it runs the module's start entry and constructors in the same order, in the calling thread, as the build before it, and the stopping pointer is set by the title's executable, not by module start. Judged unlikely from reading the code, not excluded by a run. #### What is measured | `reserved` | Source | Console result | |---|---|---| | a stack address (lower 32 bits nonzero) | obSCEne census, system software 12.40, cited in #15906 | `0x80930005` | | `0x300000000` (lower 32 bits zero) | retail title that runs on a PS5 | accepted (implied, not probed directly) | Both points fit "only the lower 32 bits are checked", but that is a guess, and it could also be a bit mask or a range. #### Proposal 1. Measure `sceAjmInitialize` on a PS5 with a valid context pointer and `reserved` = `0`, `1`, `0x100000000` and `0x300000000`, recording the return value and whether the context is written. 2. Until then, keep the refusal only where it is measured, or go back to ignoring `reserved`. In either case, extend the `sceAjmInitialize` entry in `docs/dev/debt/libSceAjm.native.md` with the case "only the upper bits set: accepted by the console (a retail title relies on it), rule not measured". 3. After the measurement, implement the rule it shows, with a test for each measured value. Related: #15906. AI-assisted: yes
Sign in to join this conversation.
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#17659
No description provided.