feat(libSceLibcInternal): forward the firmware libc-internal export surface #19434
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19434"
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 akkadbakkad89 on 2026-11-13T09:30:51Z.
What
Firmware's
libSceLibcInternal.sprxre-exports most of the libc surface under the same NIDs thatlibcprovides; we exported only ~58 of them. This forwards the firmware-4.03-catalog entries that a real title actually imports — 329*_nid_disambigN_nid_postfixwrappers, each delegating to the existing*_nid_postfixprovider (theCxxRuntimeForwards.cpppattern). The unpatched.prxexports them under their literal*_nid_disambigN_nid_postfixnames; the NID-patched build then rewrites the export table to the firmware NIDs (verified by the patched parity test, which resolvesComputeNid(name)rather than the literal symbol).Which titles demand them (firmware-4.03 harvest demand matrix — import NIDs measured from each title's eboot.bin + bundled
.sprxmodules, intersected with thelibSceLibcInternalcatalog): ACS (PPSA20397) 260, FFRESONANCE (PPSA31544) 174, GTAVC (PPSA03530) 166, GTAV 162, STELLAR 153, FFXVI (PPSA10665) 129, RDR (PPSA30528) 125, GTASA (PPSA03524) 70 — 329 unique names. Every kept name is one nolibkernel*module also exports, solibSceLibcInternalis the only firmware module that can resolve those imports. The remaining ~800 catalog entries have no measured title demand in the matrix; they can follow in later PRs once something needs them.Cross-title module-level proof: beyond the name-level matrix,
relinker --registrywas run on every locally-held eboot and every bundledsce_modulelibrary in the ACS (PPSA20397), FFXVI (PPSA10665), GTAVC (PPSA03530), RDR (PPSA30528), FFRESONANCE (PPSA31544) and GTASA (PPSA03524) dumps. The registries record the actuallibraryfield of each resolved import, which shows thelibSceLibcInternaldemand comes from titles' bundled modules — ACS'slibSceNpCppWebApi/libSceJobManager/libScePfs/libSceFontGsm/libc, FFXVI'sAmpr/AppContent/GameUpdate/NpEntitlementAccess/PlayGo, and GTAVC's full module set — not only from eboots. That module→NID matrix proves 66 distinct lci NIDs; 56 were already forwarded, and this revision adds the 8 callable NIDs that were missing:abort(L1SBTkC+Cvw — ACS/FFXVI/GTAVC),_ZdlPv(z+P+xCnWLBk — ACS/FFXVI/GTAVC),_Znwm(fJnpuVVBbKk — FFXVI),fprintf(fffwELXNVFA — ACS/FFXVI/GTAVC),ldexp(JrwFIMzKNr0 — GTAVC),_ZSt11_Xbad_allocv(eT2UsmTewbU — FFXVI),_ZSt14_Xout_of_rangePKc(ozMAr28BwSY — FFXVI),_ZSt14_Xlength_errorPKc(tQIo+GIPklo — FFXVI). The 2 remaining demanded NIDs,_Stdout(2sWzhYqFH4E) and_Stderr(H8AprKeZtNg), are 0x1c8-byteFileStreamdata objects — duplicating them insidelibSceLibcInternalwould split stdout/stderr state fromlibc's singletons, so they are recorded indocs/dev/debt/libSceLibcInternal.mdinstead of being stubbed.Signatures come from the provider declarations in
libc/include/Api.hpp— the callee signatures, which are what the shim must match (the firmware module is itself a jump table into libc; there is no separate lci-side prototype to measure). We do not have a 13.42 dump (E:\AnyPS5\firmwareholds onlyps5_prx_dump_403+ a 12.70 PUP), so the 4.03 module is the measured source for the export set itself. One generated signature was wrong vs. the provider (sceLibcPafMspaceIsHeapEmpty): the shim keeps the provider's 1-arg form and drops the extra generatedownerparameter.include/Forwards.hppdeclares all 329 for thelibSceLibcInternal.hppumbrella (public-headers audit). The newGuestLibcInternalExportParitytest loads the built.prxboth unpatched (literal names) and NID-patched (ComputeNidnames) and resolves every entry, plus a deliberately-absent probe.exitforwards through the establishedLibcExit_nid_no_patchescape hatch — firmware keepsexitliteral in libkernel, so a*_nid_postfiximport resolves to NIDuMei1W9uyNoand failsLoadLibraryExwith WinError 127 (found by the patched-load parity test, not by review).Still excluded as before: 4 names whose providers land in #18122 (
_Cnd_init_with_name, the spin-lock pair,__cxa_call_unexpected) and 13 with no provider at all (fcloseall, the*gamma*_rreentrant variants,nexttoward*,tgamma,nextafterl).Tested
MinGW GCC 15.2 Release on
main74900e8b0f.libSceLibcInternalbuilds, links and NID-patches (patched.prxbinds every shim incl. theexitno-patch import).guest_libc_internal_export_parity+guest_libc_internal_export_parity_patched— both pass; the patched variant loads the real.prxand resolves all 329 names.guest_libc_internal_variadic_forwards— calls the printf/scanf-family wrappers with four or more variadic arguments includingdouble(sprintf,snprintf,snprintf_s,sprintf_s,sscanf,sscanf_s,swprintf,printf,fprintf/fscanfround-trip through a realFileStream); the wrappers hand the guestsysvva_list to thev*providers.libc_internalfocused set: 46/46 pass.tools/check_conventions.py --base origin/main— clean.tools/pr_overlap.py --branch feat/lci-internal-forwardsflags shared base names with #19328/#19342/#19346 — those are libc-side msun accuracy fixes to the provider bodies; the shims delegate by symbol name, so no file conflict and no dependency.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:09:55Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing in the inspected forwarding and test changes shows a verified defect; the author-reported checks were not run during this review.
What I ran
Inspected the prepared diff and changed source at head
e52c0404370627c49599bf51342a017c46ed818cusingrepo_read.py. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The changed files in
files.jsonunderreviewedwere included in the prepared bundle, but this review read only targeted ranges from the diff and selected ranges ofForwards.cpp, the variadic test,CMakeLists.txt, and the umbrella header. The remainder of the changed implementation, declarations, parity test, and debt documentation was not read. Builds, tests, convention checks, the title demand matrix, and console behavior were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T12:59:32Z.
Review: COMMENTED
Reviewed — no blocking findings
The code inspected has no verified blocking defect, but the required checks were not run, so a formal merge decision is not justified.
What I ran
Reviewed head
dba6928543d6d20f19393e0c832e44ca79535263. No commands or tests were run; repository access was read-only throughrepo_read.py.Results
Negative control
Not run; no test code was changed to confirm that a failure is detected.
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Sources
Reviewed
core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/tests/GuestLibcInternalExportParity.cpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.mdat the pinned head. No changed files were excluded by the review bundle.Not verified
The build, export parity tests, variadic forwarding tests, and reported title import measurements were not independently run or confirmed. The PR description reports successful tests on a different revision (
74900e8b0f), not the reviewed head.To get this to a good state
Nothing is required. Optional: run the focused tests and build on the reviewed head, including the unpatched and patched export parity checks.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T17:00:32Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
39d22d86872eabde5154dd793116dce683baf4ba. I did not run commands or tests; the reported MinGW results are author supplied. I read the prepared description, commits, manifest and diff, plus targeted source and test ranges withrepo_read.py.Results
Findings
Blocking
None identified in the portions read.
Non-blocking
Not verified
I read all seven changed paths reported by the prepared file listing, but only targeted ranges from
core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp, andcore/libs/tests/GuestLibcInternalExportParity.cpp; the remaining portions of those files were not reviewed. I did not read the full contents ofcore/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, ordocs/dev/debt/libSceLibcInternal.md. No changed paths were marked excluded in the file listing. Build, tests, and the PR's title import demand claims were not independently verified.To get this to a good state
Nothing is required. Optional: add callable coverage for representative non-variadic wrappers and additional ABI-sensitive signatures.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-24T22:58:41Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed code I inspected shows no verified blocking defect, but I could not confirm the complete reviewed-file set or run the checks.
What I ran
Head:
5d062fe1d5773a29103a14896cf745aa9c63ba53. I read the prepared description, commits, manifest, diff, and selected ranges from changed files usingrepo_read.py. No commands or tests were run. The description reports MinGW GCC 15.2 Release checks on a different revision; those results were not independently verified.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Sources
The inspected diff adds forwarding wrappers and variadic-forward tests in
core/libs/prx/libSceLibcInternal/Forwards.cppandcore/libs/tests/GuestLibcInternalVariadicForwards.cpp. The wrappers route variadic calls throughv*providers; the test exercises formatted output and input, including floating-point and bounded cases. These observations cover only the ranges read, not every wrapper or signature.Not verified
The manifest lists eight changed files, all marked included:
core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/tests/GuestLibcInternalExportParity.cpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.md. I read selected ranges of these files, not every file in full; the providedreview/files.jsonwas unavailable through the reader, so I could not confirm its reviewed list. The repository's reported builds, tests, convention check, export parity, actual firmware behavior, and uninspected code were not verified.To get this to a good state
Nothing is required. Optional: complete the review of the remaining changed-file content and run the checks on this exact head before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T16:33:35Z.
Review: COMMENTED
Reviewed — comments
This review covers the new libc-internal forwarding surface at head
2ced2a587690afb1e6a01a78dde12b6a1aa87f8c; source and test artifacts were read, but I did not run checks, so a formal decision is not justified.What I ran
No commands or tests were run. The description reports MinGW GCC 15.2 Release checks on
main74900e8b0f; those are author-reported, not runs performed for this review.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
The changed files in the manifest's
reviewedlist were read:core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/tests/GuestLibcInternalExportParity.cpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.md. The repository reader was used to inspect targeted context incore/libs/prx/libc/include/Api.hpp. No changed files were excluded according to the review folder listing. Build, tests, and behavior on a console were not independently verified.To get this to a good state
Nothing is required. Optional: run the reported focused tests and convention check on this exact head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T16:34:10Z.
Review: COMMENTED
Actionable comments posted: 3
3bc5a21d-95e2-4907-9812-1e4f21a62cb6Reviewing files that changed from the base of the PR and between
136bb4f7d0and6c540329d6.core/libs/CMakeLists.txtcore/libs/prx/libSceLibcInternal/CMakeLists.txtcore/libs/prx/libSceLibcInternal/Forwards.cppcore/libs/prx/libSceLibcInternal/include/Forwards.hppcore/libs/prx/libSceLibcInternal/libSceLibcInternal.hppcore/libs/tests/GuestLibcInternalExportParity.cppcore/libs/tests/GuestLibcInternalVariadicForwards.cppdocs/dev/debt/libSceLibcInternal.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T16:37:45Z.
Review: COMMENTED
Reviewed — comments
The inspected portions show no verified blocking defect, but the review is incomplete because parts of the forwarding implementation and export parity test were not read.
What I ran
6c540329d65dcd3ffab7bfdbff038e69e9f0d861using the supplied review reader.Results
Findings
Blocking
None identified in the portions inspected.
Non-blocking
None.
Not verified
The remainder of
Forwards.cppafter line 1000 and the fullGuestLibcInternalExportParity.cppwere not read. The PR’s reported build and test results were not independently verified. Inspected review material:description.md,commits.md,manifest.json, and portions ofdiff.patch. Changed files accessed:core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp(partial),core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/tests/GuestLibcInternalExportParity.cpp(search only),core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.md.To get this to a good state
Nothing is required. Optional: complete inspection of the unread implementation and parity-test portions, and independently run the reported focused checks before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T16:59:42Z.
Review: COMMENTED
Actionable comments posted: 1
e06eea5a-2854-4fb8-aba1-f419fb354c27Reviewing files that changed from the base of the PR and between
6c540329d6andfbdb81e3f3.core/libs/prx/libSceLibcInternal/Forwards.cppcore/libs/prx/libc/src/Formatting.cppcore/libs/tests/GuestLibcInternalExportParity.cppcore/libs/tests/GuestLibcInternalVariadicForwards.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T18:46:46Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: move the secure scanf helper definition outside the
_WIN32guard so non-Windows builds can compile the new provider and forwarding wrapper.What I ran
Reviewed head
fbdb81e3f312eccb7cb0a0fce6d6c3b0ca35c9c1using the prepared diff andrepo_read.py. No build or tests were run.Results
Findings
Blocking
core/libs/prx/libc/src/Formatting.cpp:1842:ScanfStringSecureVaList_nid_no_patchis defined inside#ifdef _WIN32, while the non-Windowssscanf_s_nid_postfixbranch calls it at line 941. The newlibSceLibcInternalwrapper also calls it atcore/libs/prx/libSceLibcInternal/Forwards.cpp:1084. On non-Windows targets this leaves those calls without a definition and prevents the corresponding build/link from succeeding. Define the helper for both platform branches (or provide an equivalent non-Windows implementation).Non-blocking
None.
Not verified
No build or tests were run, so the platform-specific build failure is inferred from the preprocessor guards and call sites, not confirmed by a compiler. The full repository test suite and firmware behavior were not verified. Read:
core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libc/src/Formatting.cpp,core/libs/prx/libc/include/Api.hpp,core/libs/tests/GuestLibcInternalExportParity.cpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.md. The prepared manifest lists these nine changed files, all included; no changed files were excluded.To get this to a good state
Move or duplicate the helper definition so the non-Windows
sscanf_sprovider and wrapper have a definition, then build and run the relevant tests on non-Windows and Windows targets.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T13:07:54Z.
Review: COMMENTED
Reviewed — no blocking findings
The sampled forwarding and secure-scan changes show no verified blocking defect, but the full changed-file set was not reviewed, so a formal decision is not justified.
What I ran
Reviewed head
1b5f84af51145035222f9b73a83e20647801b424using the prepareddescription.md,commits.md,manifest.json, anddiff.patch; inspected targeted reader search results forsscanf_sandVaList.No tests or builds were run.
Results
Negative control
Not run.
Findings
Blocking
None verified in the sampled code.
Non-blocking
None.
Sources
Not verified
The manifest lists 9 reviewed files, all included in the prepared folder, with no rule-excluded files. I read the description, commits, manifest, and diff, and inspected targeted source context; I did not review every changed function, declaration, test, or build configuration in full. Runtime behavior, export parity, and the author-reported test results were not independently confirmed.
To get this to a good state
Nothing is required. Optional: complete review of all changed wrappers, declarations, tests, and build configuration before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-01T13:12:33Z.
Review: COMMENTED
🏛️ Architecture findings (1)
Advisory architecture findings (1)
💬 Code review
4c95433a-2718-4ff1-945c-80903bd3956bReviewing files that changed from the base of the PR and between
fbdb81e3f3and1b5f84af51.core/libs/CMakeLists.txtcore/libs/prx/libSceLibcInternal/CMakeLists.txtcore/libs/prx/libSceLibcInternal/libSceLibcInternal.hppcore/libs/prx/libc/src/Formatting.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T09:15:33Z.
Review: APPROVED
Reviewed — looks good
The reviewed head is
21aa5fa9c446202ec9b35cfb21ac60b3a30cbde2; the inspected changes support merging.What I ran
Inspected the prepared diff and file snapshots, searched the pinned source for
APS5_VABI, and checked the forward declarations against definitions. I did not run a build or tests.Results
Negative control
Not run; no tests were executed in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
v*providers, and secure string scanning uses the shared helper: Forwards.cpp, Formatting.cpp.Not verified
No build, tests, console run, or hardware behavior was verified. The author's reported test results were not independently run. Read:
core/libs/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/Forwards.cpp,core/libs/prx/libSceLibcInternal/include/Forwards.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/prx/libc/src/Formatting.cpp,core/libs/tests/GuestLibcInternalExportParity.cpp,core/libs/tests/GuestLibcInternalVariadicForwards.cpp, anddocs/dev/debt/libSceLibcInternal.md. No changed files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:02:14Z.
Review: COMMENTED
The standalone Linux variadic-forwarding fixture passed. The integrated Linux build also passed both export-parity CTests, covering the raw and patched libraries.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.