feat(libc): implement the libc++ streambuf base destructor #28709
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28709"
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 cmsierrave-coder on 2026-12-03T02:12:11Z.
What
Adds the PS5 libc++ narrow
basic_streambufbase destructor (D2). It restores the base vtable address point before releasing the embedded locale at offset0x08. The complete-object vtable slot shares theD2implementation, and the deleting slot also calls guestoperator delete. The 64-byte guest object layout and vtable relocations follow the PS5 Payload SDK v0.42ios.instantiations.cpp.oreference.The regression fixture checks that the installed locale facet releases its final reference after the vptr changes, and that the base destructor preserves the six buffer pointers and the surrounding caller storage.
Tested
Windows MSYS2 (UCRT64) built
libcand passedguest_libcxx_streambuf_lifecycleon66e4a03a3ef6. The fixture exercises destruction through both the exported entry point and the vtable slot. Fork CIThe conventions, debt fragment, and whitespace checks passed. Manual diff and merge-tree checks confirmed that the 19 branch overlap reports were already present in the dependency stack. Retail PS5 behavior and RetroArch startup remain unverified.
Rebuilt head
b0325e476369d469a46d989f9b0014522511b8a3passed conventions, debt, and whitespace checks. The eight commits form a linear stack on current upstream, and the locale core comes frommain. GitHub rejected the five-test Windows dispatch with HTTP 422 (Actions disabled).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-03T02:21:09Z.
Review: COMMENTED
Actionable comments
e95dfa34-0ad0-44d6-9a94-6313a2a4f719Reviewing files that changed from the base of the PR and between
d0658b67a8and66e4a03a3e.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/Api.hppcore/libs/prx/libc/include/GuestLocale.hppcore/libs/prx/libc/include/LibcxxStreamPosition.hppcore/libs/prx/libc/include/LibcxxStreambufTransfer.hppcore/libs/prx/libc/libc.hppcore/libs/prx/libc/src/LibcxxLocale.cppcore/libs/prx/libc/src/LibcxxLocaleFacet.cppcore/libs/prx/libc/src/LibcxxStreamPosition.cppcore/libs/prx/libc/src/LibcxxStreambuf.cppcore/libs/prx/libc/src/LibcxxStreambufLifecycle.cppcore/libs/prx/libc/src/LibcxxStreambufTransfer.cppcore/libs/prx/libc/src/exception/StandardExceptions.cppcore/libs/prx/libc/src/exception/TypeInfo.cppcore/libs/prx/libc/tests/cmake/guest_libcxx_locale.cmakecore/libs/prx/libc/tests/cmake/guest_libcxx_stream_position.cmakecore/libs/prx/libc/tests/cmake/guest_libcxx_streambuf_lifecycle.cmakecore/libs/prx/libc/tests/cmake/guest_libcxx_streambuf_transfer.cmakecore/libs/tests/GuardedBuffer.hppcore/libs/tests/GuestLibcStaticImports.cppcore/libs/tests/GuestLibcxxLocale.cppcore/libs/tests/GuestLibcxxStreamPosition.cppcore/libs/tests/GuestLibcxxStreambufLifecycle.cppcore/libs/tests/GuestLibcxxStreambufTransfer.cppdocs/dev/debt/changes/feat-libc-libcxx-locale-facet-base.mddocs/dev/debt/changes/feat-libc-libcxx-locale.mddocs/dev/debt/changes/feat-libc-libcxx-streambuf-defaults.mddocs/dev/debt/changes/feat-libc-streambuf-destruction.mddocs/dev/debt/changes/feat-libc-streambuf-metadata.mddocs/dev/debt/changes/feat-libc-streambuf-seek.mddocs/dev/debt/changes/feat-libc-streambuf-transfers.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-12-03T02:31:20Z.
Review: COMMENTED
Reviewed — no blocking findings
This is a partial review of head
66e4a03a3ef628b0babd870292575c5602a44c7f; the remaining changed files were not reviewed, so a formal decision is not justified.What I ran
I inspected the prepared diff and used
repo_read.pyat the pinned head. I did not run tests, a build, or a merged-preview check. The author reports a Windows MSYS2 build and lifecycle test pass; I did not verify that run.Results
Negative control
Not run; no test was run, so no change-to-code negative control was available.
Findings
Blocking
None identified in the files inspected.
Non-blocking
None.
Sources
Not verified
Read through
repo_read.py:core/libs/prx/libc/src/LibcxxStreambufLifecycle.cpp,core/libs/prx/libc/src/LibcxxLocale.cpp,core/libs/prx/libc/src/LibcxxStreambufTransfer.cpp,core/libs/prx/libc/src/LibcxxStreamPosition.cpp,core/libs/prx/libc/src/LibcxxStreambuf.cpp,core/libs/prx/libc/src/LibcxxLocaleFacet.cpp,core/libs/tests/GuestLibcxxStreambufLifecycle.cpp,core/libs/tests/GuestLibcxxLocale.cpp(partial), andcore/libs/tests/GuardedBuffer.hpp.The other 22 changed files in
files.jsonwere not read from the pinned source.files.jsonreports no files excluded by its rule. Retail PS5 behavior and the author-reported CI run were not verified.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and confirm the reported CI result before relying on it.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T02:54:37Z.
Review: COMMENTED
The lifecycle fixture passed on Linux x86_64 at
66e4a03a3ef6. I also allocated a streambuf with guestoperator newand invoked the deleting destructor. The last locale facet saw the restored base vtable and released exactly once. The guest allocator confirmed the object was no longer registered after the call.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T02:54:23Z.
Review: COMMENTED
Actionable comments
bce5dc2a-21e2-4905-8f39-08d188f4239cReviewing files that changed from the base of the PR and between
66e4a03a3eandb0325e4763.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/Api.hppcore/libs/prx/libc/libc.hppcore/libs/prx/libc/src/LibcxxStreambufTransfer.cppcore/libs/tests/GuestLibcStaticImports.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-04T03:25:48Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
b0325e476369d469a46d989f9b0014522511b8a3using the prepared diff and manifest, included file snapshots, andrepo_read.pysearches and reads. No tests, builds, or negative-control changes were run.The description reports a lifecycle test pass at an earlier commit and conventions, debt, and whitespace checks on this head. Its reported five-test Windows dispatch was rejected; these are author-reported results, not checks I ran.
Results
files.jsonNegative control
Not run; no test mutation or test execution was performed.
Findings
Blocking
None.
Non-blocking
None.
Sources
The destructor restores the base vtable before releasing the embedded locale, and the lifecycle fixture checks that ordering and preservation of the buffer pointers: LibcxxStreambufLifecycle.cpp, GuestLibcxxStreambufLifecycle.cpp.
The transfer implementations handle buffered copies and virtual fallbacks, with tests for partial transfers, overlapping buffers, and inaccessible memory: LibcxxStreambufTransfer.cpp, GuestLibcxxStreambufTransfer.cpp.
Not verified
reviewedinfiles.json, using the prepared diff and included snapshots. Excluded: none.To get this to a good state
Nothing is required.
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.