Skip to content

feat(libkernel): implement sceKernelGetFsSandboxRandomWord - #9

Merged
SleglJan merged 1 commit into
mainfrom
feat/libkernel-sandbox-random-word
Oct 9, 2026
Merged

SleglJan merged 1 commit into
mainfrom
feat/libkernel-sandbox-random-word

Conversation

@SleglJan

@SleglJan SleglJan commented Oct 8, 2026

Copy link
Copy Markdown
Owner

What

Adds sceKernelGetFsSandboxRandomWord to libkernel, in a new System/src/Sandbox.cpp. On the console a title's sandbox root holds app0 and a directory with a random-looking name under which system files are exposed; the function returns that name, and the open-source SDKs splice it into paths: /<name>/common/cert/CA_LIST.cer (ProsperoEden), /<name>/common/lib/libc.sprx (tiny-ps4-shell), /<name>/common/lib/mscorlib.dll (ps4-hen-plugins). The kernel keeps the name per process and randomized_path (syscall 602) reads it back, as obliteration implements it, with /system/common/lib mounted at <name>/common/lib.

  • The name is fixed, gkbHtXc3Wq, so a path built from it is the same across runs. It is recorded in TechnicalDebt: nothing is mounted under the name here, so /gkbHtXc3Wq/common/... resolves under the guest root like any other path and does not exist.
  • The pointer is to static storage and the same on every call and every thread; the function cannot fail.

In the Linux audit of the homebrew catalog (boykopovar#1578), the function was absent for 12 of the 34 relinked titles.

Overlap: none by tools/pr_overlap.py against the open pull requests. boykopovar#1748, boykopovar#1650 and boykopovar#1675 change System/src/Process.cpp, which this does not touch; the source line goes after Process.cpp in libkernel/CMakeLists.txt, the test block after guest_file_vector, and the TechnicalDebt entry after the sceKernelPread one, clear of boykopovar#1802's rewrite of the sceKernelRaiseException entries.

Tested

  • Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), full build with BUILD_TESTING=ON and ANYPS5_ENABLE_SPIRV_TOOLS=ON on this branch (based on main b858fdc): ctest --repeat until-fail:3 487/487; tools/check_test_registration.py and tools/check_conventions.py --base upstream/main pass.
  • New guest_sandbox_random_word test: a non-null, non-empty alphanumeric name, the same pointer on a second call and from another thread, and open of /<name>/common/lib/libc.sprx failing with ENOENT. Written before the implementation; it failed on the unresolved export and passes with it.
  • The patched libkernel.prx exports the NID (JGfTMBOdUJo).
  • tools/import_audit.py on four of the 12 catalog titles, absent imports on main b858fdc → this branch: PPSA17641 SymphonyStation5 35 → 34, PPSA97510 PSXS5 72 → 71, PPSA99009 ProsperoLichess 37 → 36, PPSA99082 OpenNOW PS5 - Prototype 36 → 35; the one that disappears is this function each time. No title was run, since each still has other absent imports, listed in Four open-source homebrew titles stop at start-up on unresolved imports (sysctl, pthread_set_name_np, isatty, mkstemp, signal sets, Opus decoders) boykopovar/AnyPS5#1578.
  • Windows: WINDOWSLINE

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

Returns the name of the directory under which a title's sandbox exposes
system files, which homebrew SDKs splice into paths such as
/<name>/common/cert/CA_LIST.cer and /<name>/common/lib/libc.sprx. The
name is fixed here; recorded in TechnicalDebt together with the fact
that nothing is mounted under it.

Registers guest_sandbox_random_word.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@SleglJan
SleglJan merged commit 8d47cfb into main Oct 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant