feat(libc): implement libc++ string buffer contents getter #28677
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28677"
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 mihai1859 on 2026-12-02T20:41:06Z.
What
Implement the narrow libc++ string buffer’s contents getter. It reads the full get area in input mode and the written extent in output mode, updating the high-water mark when the put cursor advances. It returns an owning guest string with the SDK’s short-string boundary and long-string layout, including embedded zero bytes. It stages the complete source before updating the high-water mark or returning a string. Both output ranges are checked before allocation and again before publication. The long-string copy opens guest write access for the payload and terminator and rechecks the buffer after allocation.
Tested
Windows,
guest_libcxx_stringbufandguest_libc_static_importspassed. The protected-page regression checks that rejected writes preserve the writable bytes and the original high-water mark. The focused cases cover empty, input, output and combined modes, a rewound put cursor, and the 22-, 23- and 24-byte string cases.Ran the same valid-buffer cases against the PS5 Payload SDK v0.42 getter.
The packaged Windows library resolves the getter in Azahar. An isolated test build with the wide-string change also resolves this getter after the full-range write checks.
Manually compared the shared files for 17 older branches that the overlap tool could not rebase.
The review follow-up passed the Windows regressions for inaccessible short and long sources, an inaccessible result, and write access to the long-string payload. The tests verify that rejected reads preserve the mark and result.
The follow-up regression verifies that a protected result returns before the long payload receives write access.
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 coderabbitai[bot] on 2026-12-02T20:47:59Z.
Review: COMMENTED
Actionable comments
85f12543-df61-4987-bd18-7f55869193b6Reviewing files that changed from the base of the PR and between
4131f5185aandabc6d73e4a.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/Api.hppcore/libs/prx/libc/src/LibcxxStringbuf.cppcore/libs/prx/libc/tests/cmake/guest_libcxx_stringbuf.cmakecore/libs/tests/GuestLibcxxStringbuf.cppdocs/dev/debt/changes/feat-libc-streambuf-string-get.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 coderabbitai[bot] on 2026-12-02T21:28:28Z.
Review: COMMENTED
Actionable comments
HostWrite.b8b256bb-b136-4fd1-8a67-04af5e9c457bReviewing files that changed from the base of the PR and between
abc6d73e4aand33cec00e54.core/libs/prx/libc/src/LibcxxStringbuf.cppcore/libs/tests/GuestLibcxxStringbuf.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T21:38:41Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: defer the high-water update until the source data has been read successfully, so a failed getter does not leave the stream buffer modified.
What I ran
Reviewed head
33cec00e5497822346715750403e5a1f14e014e2usingrepo_read.pyand the prepared review files. No tests or builds were run.Results
Findings
Blocking
putCurrentis beyondhighWater, the function writes the new high-water mark before checking whether the source range can be read. If that later read fails, the getter throws after modifying the stream buffer. Validate and stage the source data before committing the high-water update. LibcxxStringbuf.cpp:65 LibcxxStringbuf.cpp:89Non-blocking
Sources
The cited lines are from the reviewed head. The reader showed that
GuestReadable_nid_no_patchrejects inaccessible ranges, while the getter updateshighWaterbefore that check.Not verified
No tests or builds were run. The author-reported Windows tests, PS5 Payload SDK comparison, and Azahar resolution were not independently verified. All six files listed under
reviewedinfiles.jsonwere read;files.jsonlists no excluded files.To get this to a good state
Stage and validate the source bytes before updating
highWater, then rerun the focused stringbuf regression tests, including a case where the source range is unreadable and the high-water mark must remain unchanged.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T22:32:15Z.
Review: COMMENTED
Actionable comments
b4547a91-3d01-467b-9ce6-dc48ee5b5a48Reviewing files that changed from the base of the PR and between
33cec00e54andf66fbf1290.core/libs/prx/libc/src/LibcxxStringbuf.cppcore/libs/tests/GuestLibcxxStringbuf.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T22:40:17Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
f66fbf129088bab818e51de7621d88d203060c76usingrepo_read.pysearches and bounded reads of the changed code and relevant helpers. No tests or build commands were run. The author reports Windows regressions and SDK comparisons; these were not independently run for this review.Results
Negative control
Not run; no test or code change was made during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
No tests were independently run. Full title execution and the firmware provider remain unverified. All files listed under
reviewedinfiles.jsonwere read;files.jsonlists no excluded files. Additional context read throughrepo_read.py:General.cpp,General.hpp,GuestArena.cpp,GuestArena.hpp,LibcxxStringSearch.cpp, andLibcxxStringErase.cpp.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T22:51:44Z.
Review: COMMENTED
Actionable comments
70bfa145-2aeb-4aa4-a1e3-c6ed6719ebc5Reviewing files that changed from the base of the PR and between
f66fbf1290anda991a628d0.core/libs/prx/libc/src/LibcxxStringbuf.cppcore/libs/tests/GuestLibcxxStringbuf.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T23:17:45Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
a991a628d0d2cd7a1b6864bbe24019ab08d4c2cfin the Linux review environment. No compiler, build system, or tests were run.The reader returned the pinned source file, but its subsequent search failed because the sandbox blocked its
reads.jsonlwrite.Results
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
Files inspected:
core/libs/prx/libc/CMakeLists.txt,core/libs/prx/libc/include/Api.hpp,core/libs/prx/libc/src/LibcxxStringbuf.cpp,core/libs/prx/libc/tests/cmake/guest_libcxx_stringbuf.cmake,core/libs/tests/GuestLibcxxStringbuf.cpp, anddocs/dev/debt/changes/feat-libc-streambuf-string-get.md.files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T01:39:21Z.
Review: COMMENTED
I independently ran
GuestLibcxxStringbufon Linux with the libc runtime sources linked into the test. It passed, including the 22/23/24-byte boundary, embedded NUL, output high-water updates, and guarded cases. I added a temporary case that changes the stream's high-water mark from the host-write hook for the long-string payload. The getter threw, preserved the intervening high-water update, and left all 24 output bytes at their sentinel value.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T07:35:05Z.
Review: APPROVED
I read the diff at
a991a628d0. Merged intomainat35e34b1a7f0together with other open PRs (so not an isolated build), Release, on Windows 11 (GCC 15.2) and Ubuntu 24.04 under WSL2 (GCC 13.3).guest_libcxx_stringbuf: passes on both.guest_libcxx_*tests of that tree pass too (39 on Linux).maindoes not have.Not checked: a title.
AI-assisted: yes (Claude Code)
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.