feat(libSceLibcInternal): forward _new_setup and the two-path _Xfilesystem_error to libc #24573
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24573"
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 PostMalloy on 2026-11-20T20:03:13Z.
What
libSceLibcInternalexported two NIDs as throwing stubs althoughlibcalready implements both:libSceLibcInternalstublibcimplementation_new_setupKNNNbyRieqQlibSceLibcInternalInventory_275(InventoryExports.cpp)RuntimeSupport.cpp, from thelibc.prxof PPSA01341_ZNSt10filesystem18_Xfilesystem_errorEPKcRKNS_4pathES4_St10error_codeWut42WAe7RwsceLibcInternalPending4_123(Export.cpp)StandardExceptions.cpp, from thelibc.prxof PPSA06416A title importing either NID from
libSceLibcInternalreached the stub. Thelibcdebt entry forstd::filesystem::_Xfilesystem_erroralready describes it as alibSceLibcInternalexport implemented inlibc.libckeeps the two bodies inCrtNewSetup_nid_no_patchandFilesystemErrorTwoPaths_nid_no_patch, and its own exports call them, so their behaviour is unchanged.libSceLibcInternalstubs take thelibcprototypes and call the same helpers. Calling the_nid_no_patchhelpers instead of thelibcexports keeps the forwards from binding to themselves after NID patching, as6c5bee0did for the otherlibSceLibcInternalforwards._new_setuptherefore records its CRT table inlibc's slots whichever module the title imports it from.Wut42WAe7Rw"import resolution only" entry and adds one for the two forwards. It says that neitherlibSceLibcInternal.sprxbody was read, so whether it differs from thelibc.prxone is not known.I found these by matching every throwing stub's NID against the implemented exports of the other libraries. Of the 2308 open pull requests, 25 change one of the touched source files. By their GitHub file patches, none changes either export: #17300 and #18135, both already conflicting with
main, and #19486 show them only as diff context.gh search prsfinds no open PR mentioning_new_setupor_Xfilesystem_errorother than #17300.Tested
Windows 11 x64 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0, Release.
guest_libc_internal_libc_forwards, newCheckNewSetupandCheckFilesystemErrorTwoPaths, through thelibSceLibcInternalexports:_new_setupaccepts a null table, refuses a table shorter than 0x50 bytes, accepts a table without slots and refuses a partly filled slot group, aslibc's rule does._Xfilesystem_errorwith two short guest paths throws a guest exception that astd::system_errorhandler catches, with type nameNSt10filesystem16filesystem_errorE.std::invalid_argument._new_setupforward return 0 and the_Xfilesystem_errorforward throwstd::invalid_argumentwithout reachinglibcmakes the test fail: both_new_setuprefusal checks fail, and the guest catch of the filesystem error aborts the process.guest_libc_internal,guest_crt_setup,guest_filesystem_errorandguest_sce_v2_exceptionspass after rebuilding them on currentmainwith this commit.tools/check_conventions.py --base origin/mainandtools/debt_fold.py --checkpass.tools/nid_names.pygivesKNNNbyRieqQfor_new_setupandWut42WAe7Rwfor the_Xfilesystem_errorname, the NIDs the stubs exported.No title was found calling either export through
libSceLibcInternal, and no PS5 hardware was used.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 MarcZX10 on 2026-11-20T20:24:12Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation and tests support merging.
What I ran
Reviewed head
53ecbfe76529811a75209276e4ec56954ffae75cusingrepo_read.pyto inspect the prepared diff, all changed files, and targeted declarations and callers. No commands or tests were run here. The Windows, GCC, test, convention, and debt-check results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run during this review; author-reported test results were not independently verified. No PS5 hardware behavior or title imports were verified. All files marked
reviewedin the manifest were read;files.jsonwas not available through the reader, and no excluded repository files were identified in the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T00:47:05Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
53ecbfe765:tools/check_conventions.pypassed.guest_libc_internal_libc_forwards_testsbuilt cleanly.guest_libc_internal_libc_forwards):core/libs/prx/libSceLibcInternal/Export.cpp,core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp,core/libs/prx/libc/include/Api.hpp,core/libs/prx/libc/src/RuntimeSupport.cpp,core/libs/prx/libc/src/exception/StandardExceptions.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me