feat(libkernel): load system libraries from their console paths #6519
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6519"
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 Get-fix on 2026-10-15T18:36:40Z.
What
PS4 programs load system libraries with
sceKernelLoadStartModuleand their console path. The OpenOrbis piglet sample loads/<sandbox word>/common/lib/libScePigletv2VSH.sprxandlibScePrecompiledShaders.sprx, the sandboxed form of/system/common/lib/thatsceKernelGetFsSandboxRandomWordnames. AnyPS5 opened that path as a guest file, so the load failed withENOENTand the sample stopped with:A path in
/system/common/lib/or in the sandboxed/<word>/common/lib/whose file name ends in.sprxnow loads the hostlibs/<name>.prx, as libSceSysmodule does for module IDs. A name with a directory part is not mapped, so such a path cannot leavelibs/. Any other path is opened as before. The new line indocs/dev/debt/libkernel.mdrecords that a host library has nomodule_start, soresis 0, and that other system directories, such as/system/priv/lib, are not mapped. Part of the PS4 homebrew work tracked in #3093.Overlap with open pull requests that change
Module.cppordocs/dev/debt/libkernel.md, checked withgit merge-fileagainstmain03c4cb5e7:#include <mutex>on the line where this adds#include <optional>; whichever merges second keeps both includes.docs/dev/debt/libkernel.md; whichever merges second keeps both entries.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain03c4cb5e7:guest_dynamic_loadernow copies its fixture module intolibs/and loads it through/system/common/lib/<name>.sprxand/gkbHtXc3Wq/common/lib/<name>.sprx(gkbHtXc3Wqis AnyPS5's sandbox word). It calls the module's export and unloads it each time. A missing name and a.prxname return0x80020002, and so does/gkbHtXc3Wq/common/lib/../<name>.sprx, even though the file exists one directory up./system/common/lib/prefix not mapped, a name with a directory part mapped.main03c4cb5e7with this, #6520, #6521, #5990 to #5994, #6376, #5138 and a change that answers the LinuxTIOCGWINSZwithENOTTY, as #5569 did: it printsModule prefix = /gkbHtXc3Wq/common/lib/andModules loaded OK., and draws its rotating textured square at 59.96 FPS. WithModule.cppfrommaininstead, it stops with the lines above.agc_driver_gpu_indirect_arguments_misaligned_writer_aheaddoes not compile with MinGW onmain(#6452 fixes it), andprx_thread_local_destructorsfails as it did onmain92cdc7b62on this machine without my changes.tools/check_conventions.pypasses.Not tested on Linux or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T19:30:57Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libkernel.mdL235Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Module/src/Module.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestDynamicLoader.cppcore/libs/prx/libkernel/Module/src/Module.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/tests/GuestDynamicLoader.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Module/src/Module.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/Module/src/Module.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T20:04:11Z.
Review: COMMENTED
Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head
57dbfcaddmerged ontomain44df21632.guest_dynamic_loaderandguest_dynamic_loader_fixed_basepass.Module.cppfrommainand the PR's test, both abort atGuestDynamicLoader.cpp:106(the/gkbHtXc3Wq/common/lib/<name>.sprxload), so the test protects the change on Linux too.Non-GPU suite (
ctest -E "^agc"): same result asmain; onlyfile_writer_binaryandfile_writer_textfail, and they fail onmaintoo on this machine (Ubuntu 26.04 coreutils).Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T23:26:27Z.
Thanks for the Linux run, @jotitadev, including the check that the test fails at the sandboxed-path load without the change.
About the overlap the bot lists with #6544: I merged #6544 with
git merge-fileagainstmain5d9dcc42d, with and without this change. The only conflict is incore/libs/tests/GuestDynamicLoader.cpp, where each pull request adds an independent block of test code at the same place: this one its console-path loads, #6544 its nestedprx/*.guest.prxcase. Keeping both blocks resolves it. The production changes,Module.cpphere andGeneral.cppin #6544, do not overlap.AI-assisted: yes (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T18:19:51Z.
Rebase handoff — this PR conflicts with
mainonly indocs/dev/debt/libkernel.md(two entries appended at the end of the file). I rebased it ontomain892a4f1328: the original commit and its author are unchanged, the only difference is the conflict resolution in the debt file (both entries kept). Nothing in the code or the test was changed.Windows data (Windows 10 19045, MinGW-w64 GCC 15.2.0, Release):
guest_dynamic_loaderfails withModule.cpptaken back tomain(GuestDynamicLoader.cpp:176, exit code0xc0000409) and passes with this change, 3 of 3 runs;guest_sysmoduleandguest_module_infopass;python tools/check_conventions.py --base upstream/mainpasses. Not run: Linux, macOS, the piglet sample. The relinker Python testsguest_module_*did not run in my build (relinker binary not built), so they are not covered.To pick it up:
(
fdacba6338on top of892a4f1328.) I did not open a second pull request.AI-assisted (Claude Code).