relinker: God of War Ragnarök's bundled libc.prx has an inline _umtx_op wait (syscall 454) with a non-FreeBSD argument layout #12123

Open
opened 2026-10-27 22:06:54 +00:00 by B-Howell · 0 comments
B-Howell commented 2026-10-27 22:06:54 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-10-27T22:06:54Z.


What happens

God of War Ragnarök (PPSA08329, content version 06.006.000) doesn't convert. The relinker refuses the title's bundled sce_module/libc.prx (SHA-256 a485b34e…04e443) with exit code 2 and writes no output:

FAIL: Forbidden syscall instruction at code offset 0x116c84 (offset 0x116c84)
Input: .../sce_module/libc.prx

On main f759e165d9 (relinker-only Release build, Ubuntu 22.04 WSL, GCC 11.4), the refusal is the same with --windows --to-intel, with --trap-sdk-syscall-stubs added, and for Linux output. This is the only raw syscall in the library's executable segment.

The refused code

The syscall is inside a small leaf helper at 0x116c50. Its only reference is a tail jump at 0x116bb0. I read it statically and haven't run it:

  1. rdx is an optional pointer to a 32-bit timeout in microseconds. If it isn't null, the helper pushes a timespec (sec = t / 1000000, nsec = (t % 1000000) * 1000) and keeps its address in rcx. Otherwise rcx is 0.
  2. rax = 0x1c6 (454, FreeBSD _umtx_op). rdi gets bit 63 set (bts rdi, 63), rsi = 2 (UMTX_OP_WAIT), rdx = 0, and r10 = rcx (the timespec, or null). r8 isn't set.
  3. After syscall it pops the timespec if one was pushed and returns the raw rax. It doesn't check the carry flag.

Why this needs console data, not a route to _umtx_op

Two arguments don't follow the FreeBSD 11 UMTX_OP_WAIT that libkernel's _umtx_op implements:

  • FreeBSD reads the timeout from uaddr2 (r8), with its size in uaddr1 (r10). This helper passes the timespec pointer in uaddr1 and leaves uaddr2 unset.
  • It sets bit 63 of the object address. Nothing in AnyPS5 or FreeBSD gives that bit a meaning, and the host implementation would reject the address.

So the PS5 kernel's ABI for this call is unknown. Neither of the existing paths would work:

  • --trap-sdk-syscall-stubs would turn the helper into a UD2 that the title probably reaches, since it's a wait primitive.
  • Routing it to the host _umtx_op would read the wrong timeout and fault on the address.

What would settle it is a console measurement of syscall 454 with op 2: an address with bit 63 set, a timespec in uaddr1 and uaddr2 null, covering the return value, the carry flag and the wait/timeout behaviour. Then the relinker could match this exact helper and call a host function with that behaviour. @rooklz, your #10789 measurements came from a payload on firmware 13.40; is this something you could check?

Related: #10219 covers homebrew SDK stubs whose ABI matches FreeBSD, and #11137 traps the mount family. Neither covers this shape.

AI-assisted (Claude Code). Static reading and conversion runs only; nothing was launched.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6068554764 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/12123). Originally posted by [B-Howell](https://github.com/B-Howell) on 2026-10-27T22:06:54Z. --- ### What happens God of War Ragnarök (PPSA08329, content version 06.006.000) doesn't convert. The relinker refuses the title's bundled `sce_module/libc.prx` (SHA-256 `a485b34e…04e443`) with exit code 2 and writes no output: ``` FAIL: Forbidden syscall instruction at code offset 0x116c84 (offset 0x116c84) Input: .../sce_module/libc.prx ``` On `main` `f759e165d9` (relinker-only Release build, Ubuntu 22.04 WSL, GCC 11.4), the refusal is the same with `--windows --to-intel`, with `--trap-sdk-syscall-stubs` added, and for Linux output. This is the only raw `syscall` in the library's executable segment. ### The refused code The `syscall` is inside a small leaf helper at `0x116c50`. Its only reference is a tail jump at `0x116bb0`. I read it statically and haven't run it: 1. `rdx` is an optional pointer to a 32-bit timeout in microseconds. If it isn't null, the helper pushes a `timespec` (`sec = t / 1000000`, `nsec = (t % 1000000) * 1000`) and keeps its address in `rcx`. Otherwise `rcx` is 0. 2. `rax = 0x1c6` (454, FreeBSD `_umtx_op`). `rdi` gets bit 63 set (`bts rdi, 63`), `rsi = 2` (`UMTX_OP_WAIT`), `rdx = 0`, and `r10 = rcx` (the timespec, or null). `r8` isn't set. 3. After `syscall` it pops the timespec if one was pushed and returns the raw `rax`. It doesn't check the carry flag. ### Why this needs console data, not a route to `_umtx_op` Two arguments don't follow the FreeBSD 11 `UMTX_OP_WAIT` that `libkernel`'s `_umtx_op` implements: - FreeBSD reads the timeout from `uaddr2` (r8), with its size in `uaddr1` (r10). This helper passes the `timespec` pointer in `uaddr1` and leaves `uaddr2` unset. - It sets bit 63 of the object address. Nothing in AnyPS5 or FreeBSD gives that bit a meaning, and the host implementation would reject the address. So the PS5 kernel's ABI for this call is unknown. Neither of the existing paths would work: - `--trap-sdk-syscall-stubs` would turn the helper into a `UD2` that the title probably reaches, since it's a wait primitive. - Routing it to the host `_umtx_op` would read the wrong timeout and fault on the address. What would settle it is a console measurement of syscall 454 with op 2: an address with bit 63 set, a `timespec` in `uaddr1` and `uaddr2` null, covering the return value, the carry flag and the wait/timeout behaviour. Then the relinker could match this exact helper and call a host function with that behaviour. @rooklz, your #10789 measurements came from a payload on firmware 13.40; is this something you could check? Related: #10219 covers homebrew SDK stubs whose ABI matches FreeBSD, and #11137 traps the `mount` family. Neither covers this shape. AI-assisted (Claude Code). Static reading and conversion runs only; nothing was launched.
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#12123
No description provided.