fix(libkernel_sys): reach rename through a _nid_no_patch export #5025
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5025"
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 0xRickx on 2026-10-13T08:51:12Z.
What
Since
2a8e7452(renameat, #4877),libkernel_sys.prxfails to load on Windows (patched_libraries:libkernel_sys.prx: LoadLibraryEx failed with error 127), and so does every title that imports it: ten catalog titles, among them ProsperoRadio PPSA99001, vkQuake PPSA99010, PS5VR PPSA99177 and Porpoise PPSA99764.renameatcallsrename_nid_postfixwhen both paths areAT_FDCWD-relative or absolute.libc/src/Rename.cppis built into both libc and libkernel, andlibkernel_sysbound that import to libkernel, which comes first on its link line. The NID patcher then rewrote the import torename's NID (NN01qLRhiqU). Only libc exports that NID: libkernel keeps its copy under the plain name because libc exports it too. Linux resolves the symbol globally, so only Windows was affected.rename's body is nowRenameGuestPath_nid_no_patch, which both libraries export under that name, andrenameatcalls it, the waylibkernel_sysalready reachesGetDirectoryDescriptorPath_nid_no_patchand libkernel's other helpers.rename_nid_postfixforwards to it, so its behaviour is unchanged.Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, on
main4bb2c7f3:patched_libraries: onmainit fails onlibkernel_sys.prxwith error 127; with this change "127 patched libraries loaded, 0 failed".guest_kernel_sys,guest_kernel_renameandguest_filesystempass.main's relinker: onmainit stops withFailed to load module: ...\libs\libkernel_sys.prx/GetLastError: 127; with this change it loads and runs. Porpoise PPSA99764 loads again and stops at its bring-up stop,VideoOut: port already open(#4863).tools/check_conventions.py --base upstream/mainpasses.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)libkernel_sys.prx, on WindowsImported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T09:33:06Z.
Additional Windows validation, based on current
main2a2a3dc650b9245fb0fb9b088afb1a6c27637f7d, WinLibs GCC 15.2.0 / Ninja Release / RTX 5070 / driver 617.42. Applied exact PR head9ceb6d144d5f35994f4d8488bffb751550c3823eas a clean cherry-pick; integration head6428632e6.On unmodified main, the full Windows CTest run registered 1,051 tests: 1,042 passed, eight skipped, one failed (
patched_libraries,libkernel_sys.prxloader error 127), 124.92 s. A fresh ProsperoLight PPSA99002 v01.000.100 conversion failed at startup with the same loader error; Windows import diagnostics identifyNN01qLRhiqUfromlibkernel.prxas the unresolved dependency.With this PR, built the affected runtime and ran
patched_libraries,guest_kernel_sys,guest_kernel_renameandguest_filesystem: four passed, 0.35 s. A fresh ProsperoLight conversion then remained running for the entire 60-second diagnostic and was deliberately stopped at the deadline, with no loader failure or fatal message in stderr. Its catalog archive SHA-256 was verified before conversion, and its runtime manifest and source commit were recorded privately. No builds or tests overlapped the title.This establishes a startup unblock. I did not verify rendered output, interaction or game-streaming functionality and do not claim it playable. Raw title artifacts remain private. AI-assisted validation with Codex; original implementation and authorship preserved.
Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-14T00:32:35Z.
Tested on Windows after the merge: it fixes the
libkernel_sys.prxload failure for the four catalog titles I have relinked, andpatched_librariespasses.Host: Windows 11 Pro, Intel Core i9-14900K, 128 GB, NVIDIA GeForce RTX 5080 (driver 32.0.16.1714), WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON.Builds: base
4bb2c7f3947440d513b1dbd12143ec55b250495a(this PR's base) and head9ceb6d144d5f35994f4d8488bffb751550c3823e(pull/5025/head), same build directory, targetsrelinker libs patched_libraries_tests guest_kernel_sys_tests guest_kernel_rename_tests guest_filesystem_tests.Tests:
ctest --timeout 120 --parallel 2 -R "^(patched_libraries|guest_kernel_sys|guest_kernel_rename|guest_filesystem)$"patched_librarieslibkernel_sys.prx: LoadLibraryEx failed with error 127,126 patched libraries loaded, 1 failedguest_kernel_sys,guest_kernel_rename,guest_filesystemTitles: catalog release ZIPs checked against the catalog sha256;
eboot.binandsce_module/libc.prxunwrapped from their SELF containers; relinked with each build's own relinker (relinker --windows --registry eboot.elf app.exe), that build'slibs/*.prxplus the three MinGW DLLs, the package contents asapp0/. Run for up to 60 s.Failed to load module: ...\libs\libkernel_sys.prx/GetLastError: 127 - The specified procedure could not be found.[psxs5] pad 1: Player (17 buttons, 6 axes)), then stops atwhat(): poll: POLLPRI is not supported by WSAPollwhat(): poll: POLLPRI is not supported by WSAPoll(2.2 s)XashPS5: the "valve" folder is incomplete (valve/liblist.gam is missing).Quake Error: W_LoadWadFile: couldn't load gfx.wad(no game data)The
POLLPRIstop that PSXS5 and ProsperoRadio reach next is theWSAPollpath inSocket/src/Udp.cpp, not this change; #4525, merged after this PR's base, handles it onmain.Code:
renameandrenameatnow both go throughRenameGuestPath_nid_no_patch, which libc and libkernel both export under that name, so the importlibkernel_sysbinds to libkernel resolves by name on Windows;rename_nid_postfixkeeps its body through the forward. The helper reports errors througherrno, and__error()returns&errnoof the shared UCRT, so which of the two copies runs makes no difference to the guest.Verdict: works as described; no change requested.