Relinker: seven catalog homebrew titles stop on raw FreeBSD syscall stubs from the ps5-payload-dev SDK libc #2136
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 overlordxrz-source on 2026-10-09T09:50:55Z.
Title: Relinker: seven catalog homebrew titles stop on raw FreeBSD syscall stubs from the ps5-payload-dev SDK libc
What
On main
6cc0503da, seven titles from ps5-homebrew-catalog (https://github.com/blackbearreloaded/ps5-homebrew-catalog) fail to relink with "FAIL: Forbidden syscall instruction at code offset 0x…":These failures are genuine. Each stop is a real syscall instruction from libc/syscalls.c in the ps5-payload-dev SDK (https://github.com/ps5-payload-dev/sdk/blob/master/libc/syscalls.c):
The relinker's own decoder finds 233 such sites per title, which is every function in that file. They sit in one contiguous block, and there are no other hits. The 39 other catalog titles have none. Scanner sync looks correct.
Most stubs are dead code. The direct callers I found:
Because guest code runs natively, --skip-syscall-check would run Linux syscalls with the same numbers. For example, FreeBSD link (9) would run mmap, and symlink (57) would run fork. That flag is not a workaround here.
Question
Which direction would you accept?
This does not overlap #1935, which rejects prefixed syscall instructions. None of these hits are prefixed, and no catalog title has a prefixed one.
Tested
6cc0503da, built natively (aarch64 Linux, zig c++ 0.17 with the CMake target's sources).AI use: an AI assistant helped with the scanning tools, the disassembly and this write-up. I reviewed the results.
Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-11T03:18:18Z.
Rig data for this wall on current main (
6c9cb3a5, Linux x86_64, 60 s per title). Nine catalog titles stop here:--trap-sdk-syscall-stubssyscall()04AjkP0jO9U5G2ONUzRgjYlink)5G2ONUzRgjYr28hEh6cNH0aML18Z0J0t0VUzjXknPPBsoxMp8uPqa+U04AjkP0jO9USo 8 of 9 hit only the ps5-payload-dev
libc/syscalls.cstubs, and with them trapped (ud2) they relink and move on to ordinary import stops. None of the 8 reached a trapped stub at runtime (no SIGILL in any run). Nuvio Max'd has one raw syscall outside the SDK block, and the flag correctly still rejects it.The branch keeps this opt-in so the default and #2206's test don't change. Every non-SDK syscall still fails the relink, and the tests cover Linux/Windows output, guest modules, and nine shapes that must still be rejected. Would you take it as an opt-in flag, or do you prefer the trap by default, or routing the stubs to host implementations?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:55:29Z.
I opened PR #3804 with an opt-in implementation of the deferred-failure direction.
--trap-sdk-syscall-stubsrecognizes only the exact numbered and generic SDK wrapper byte patterns described here, then replaces thesyscallinstruction withUD2in the main executable and bundled guest modules. Unrecognized syscall instructions still stop relinking, and default behavior is unchanged. If one of the trapped wrappers runs, it raises an illegal-instruction exception; the flag does not emulate FreeBSD syscalls.The Linux x86_64 relinker-only Release build passed, along with all 115 relinker-only CTest tests. This validates the generated patches with fixtures; I did not run the catalog titles. The PR has the AI-assisted disclosure.
Imported from boykopovar/AnyPS5. Originally posted by hansjm10 on 2026-10-11T18:29:23Z.
What PS5 FSR4 Showcase (PPSA99011, 01.000.010, the catalog's zip, sha256 matching) hits after the SDK stubs, with #3804 (
0a6247532) onmaina11c8f7f7, Linux, RADV:--trap-sdk-syscall-stubstraps 233 sites (231 numbered, 2 generic) and the title relinks.tools/import_audit.py: 213 of 215 imports implemented, one stub (sceSystemServiceLoadExec), one absent, which is where the loader stops:r28hEh6cNH0issceAgcDriverGetHsOffchipParam. Its only callers in ps5-vulkan, the Vulkan layer the showcase pins at4bb0c8b, are on tessellation paths (graphics_queue_ps5.cL2241). With a throwing export, the run below never reaches it.platform_ps5.cL99 loads internal module0x80000094, whichModuleTable.hpplacks:libNidResolversysmodules.cL245 names itlibSceAgc, the table #2541 used for0x110.sceAgcInit: unsupported register defaults version. ps5-vulkan callssceAgcInit(&state, sizeof(state))(L106), while its own probe build calls the export with a scalar version,__real_sceAgcInit(11)(graphics_main.cL68). AnyPS5 takes a version below 14. What the console does when a stack address lands in that argument is unknown, so I'm not taking this one.No trapped stub was reached (no SIGILL). I'm taking 1 and 2 as two PRs, each
Depends on: #3804.AI-assisted: yes (Claude Code).