libkernel/libSceLibcInternal: functions, permission persistence and LoadExec handover needed by PS5 homebrew #3293

Closed
OmarKasmi wants to merge 3 commits from upstream-pr/3293 into main
OmarKasmi commented 2026-10-11 05:52:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by OmarKasmi on 2026-10-11T05:52:04Z.


What

Three independent changes that make free PS5 homebrew titles boot through the relinker:

  1. New library functions (libkernel, libSceLibcInternal) — the pthread attribute/affinity/spinlock family, cond_reltimedwait_np, set_name_np, pause, truncate, sceKernelGetSystemSwVersion, the long-double math set, getopt_long+optarg/optind, memrchr, strsep, dirname, getc_unlocked/putc_unlocked, mbstowcs (UTF-8→32-bit wchar), malloc_usable_size, getprogname, tzname, __fpclassifyd. Nine still-unsupported NIDs (kqueue, kevent, sendfile, sigsetjmp, shm_unlink, _umtx_op, the sceKernelJit trio) become named throwing stubs in Unimplemented.cpp, following the existing sceKernelUnknownXX convention.

  2. chmod permission persistence (libkernel) — Windows stat synthesizes modes that never match what chmod set, so titles that verify and repair installed permissions on every start (RetroArch PS5 repairs 13,854 files per boot as a PS5 pkg-install workaround) boot-loop forever. Requested bits are now remembered per path, served back from stat/fstat (including \Device→drive conversion for descriptor queries), and persisted across processes.

  3. sceSystemServiceLoadExec handover (libSceSystemService, Windows) — every path except "exit" threw. Titles use it for first-run self-relaunch and to hand over to companion executables (RetroArch PS5 relaunches into its picker/EmulationStation frontends). The guest /app0/... path now maps to a relinked <stem>.exe sibling, with argument forwarding and clean termination.

Validation

Console-free, using only free homebrew releases (OmarKasmi/anyps5-hb, a bench that audits public homebrew against the built libraries):

  • RetroArch PS5 v1.0.0-beta.1: picker.bin and es-de.bin — every import resolves (348 and 437; previously 61 absent NIDs); eboot relinks, loads all modules, transfers control, runs its permission pass, and completes its handover chain
  • import audits before/after: absent 61 → 0 for all three executables

Caveats

  • Validated against the RetroArch PS5 title family only; no retail title was harmed (or available) in the making of this PR
  • setitimer reports success without delivering signals; happy to switch it to a throwing stub if that fits the project's strictness better
  • pthread_attr_getscope/setscope use a side table rather than a field on PthreadAttrPrivate — happy to move it in-tree if preferred
  • No new tests yet; I can add guest tests for the chmod round-trip and the libc additions if the approach looks right

The bench that generated the validation data is public and CI-driven, so the effect of each commit is reproducible without a console.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4816926325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3293). Originally posted by [OmarKasmi](https://github.com/OmarKasmi) on 2026-10-11T05:52:04Z. --- ## What Three independent changes that make free PS5 homebrew titles boot through the relinker: 1. **New library functions** (`libkernel`, `libSceLibcInternal`) — the pthread attribute/affinity/spinlock family, `cond_reltimedwait_np`, `set_name_np`, `pause`, `truncate`, `sceKernelGetSystemSwVersion`, the long-double math set, `getopt_long`+`optarg`/`optind`, `memrchr`, `strsep`, `dirname`, `getc_unlocked`/`putc_unlocked`, `mbstowcs` (UTF-8→32-bit wchar), `malloc_usable_size`, `getprogname`, `tzname`, `__fpclassifyd`. Nine still-unsupported NIDs (kqueue, kevent, sendfile, sigsetjmp, shm_unlink, `_umtx_op`, the `sceKernelJit` trio) become named throwing stubs in `Unimplemented.cpp`, following the existing `sceKernelUnknownXX` convention. 2. **chmod permission persistence** (`libkernel`) — Windows `stat` synthesizes modes that never match what `chmod` set, so titles that verify and repair installed permissions on every start (RetroArch PS5 repairs 13,854 files per boot as a PS5 pkg-install workaround) boot-loop forever. Requested bits are now remembered per path, served back from `stat`/`fstat` (including \Device→drive conversion for descriptor queries), and persisted across processes. 3. **`sceSystemServiceLoadExec` handover** (`libSceSystemService`, Windows) — every path except `"exit"` threw. Titles use it for first-run self-relaunch and to hand over to companion executables (RetroArch PS5 relaunches into its picker/EmulationStation frontends). The guest `/app0/...` path now maps to a relinked `<stem>.exe` sibling, with argument forwarding and clean termination. ## Validation Console-free, using only free homebrew releases ([OmarKasmi/anyps5-hb](https://github.com/OmarKasmi/anyps5-hb), a bench that audits public homebrew against the built libraries): - RetroArch PS5 v1.0.0-beta.1: **picker.bin and es-de.bin — every import resolves** (348 and 437; previously 61 absent NIDs); eboot relinks, loads all modules, transfers control, runs its permission pass, and completes its handover chain - import audits before/after: absent 61 → 0 for all three executables ## Caveats - Validated against the RetroArch PS5 title family only; no retail title was harmed (or available) in the making of this PR - `setitimer` reports success without delivering signals; happy to switch it to a throwing stub if that fits the project's strictness better - `pthread_attr_getscope`/`setscope` use a side table rather than a field on `PthreadAttrPrivate` — happy to move it in-tree if preferred - No new tests yet; I can add guest tests for the chmod round-trip and the libc additions if the approach looks right The bench that generated the validation data is public and CI-driven, so the effect of each commit is reproducible without a console.
github-actions[bot] commented 2026-10-11 05:52:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T05:52:16Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105995478 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3293#issuecomment-6105995478). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T05:52:16Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Pull request closed

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!3293
No description provided.