fix(libc): return the bad_alloc and bad_function_call what() strings of the libc.prx titles ship #11213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11213"
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 AlexFigas on 2026-10-25T21:55:44Z.
What
std::bad_alloc,std::bad_array_new_lengthandstd::bad_function_callreturnedstd::bad_alloc,std::bad_array_new_lengthandstd::bad_function_callfromwhat(). Thelibc.prxthat PPSA21564 bundles (sce_module/libc.prx, the library's own code) returnsbad allocation,bad allocationandbad function call. Every vtable below was resolved through the module'sR_X86_64_RELATIVErelocations, read from the disassembly, not measured:what()in thatlibc.prxstd::bad_allocbad allocation(_ZNKSt9bad_alloc4whatEv, 0x16fa0)std::bad_allocstd::bad_array_new_lengthbad allocation(its vtable points atbad_alloc::what)std::bad_array_new_lengthstd::bad_function_callbad function call(0x177d0)std::bad_function_callstd::bad_cast,std::bad_typeidstd::bad_cast,std::bad_typeidstd::bad_weak_ptr,std::bad_variant_accessbad_weak_ptr,bad_variant_accessThe library's
__sce_v2bad_function_callalready returnedbad function call. The_Xbad_alloccase ofguest_sce_v2_exceptionsand the plainwhatmode ofguest_message_destructor_abi, which expected the oldbad_allocstring, now expectbad allocation.Not changed here:
libc.prx,std::exception::what(0x17040) returns an empty string.std::bad_exceptionandstd::bad_optional_accessdon't override it (their vtables point at it), so they return it too.std::exception,St13bad_exceptionandbad_optional_access.what()forstd::exception, so these three are left for a follow-up.bad_variant_accessandbad_optional_accessare not edited here, because four open PRs change the lines around them.Tested
Ubuntu 24.04 (WSL2), GCC 13.3, Release build with
BUILD_TESTING=ON, headedeac65600onmain1089f2bbfd. Thatmainhas thefuture_error/error_category(#11241) andunderflow_error(#10608) exports inStandardExceptions.cppand the SCE v2 test-overread fix (#10829):guest_sce_v2_exceptions,guest_bad_optional_accessandexception_runtimepass 3 runs each, as doexception_personality,exception_c_cleanup,host_libstdcxx_exceptionandunwind_callback_abi_delete_exception.guest_message_destructor_abiis built only with MinGW, so I did not run it, and the hosted Windows job cannot either: on pull requests it only links the host-only tests, and this one links the guestlibc. Its expected string is updated the same way.python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch fix/libc-exception-what-stringsfinds no overlap. #10927 addsstd::_Throw(const std::bad_array_new_length&), and its test does not check the string.No title run.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T11:00:04Z.
Review: CHANGES_REQUESTED
The bundled libc.prx vtable/string evidence is specific, and the changed mapping plus expectation updates are small. I am not approving this submitted head yet because it is based on
88f99678bf, while current main is3fea2a937b. Since that base, main changed StandardExceptions.cpp and the guest exception tests this PR edits (including the SCE v2 test-overread fix). The current diff therefore has not been checked against the current implementation and fixtures.Please rebase onto current main, rerun the affected exception tests on that tree, and report the MinGW-only guest_message_destructor_abi result if the Windows check can execute it. I found no independent defect in the small string mapping itself; this request is for current-tree integration and repeatable test evidence under the repository's branch-currency rule.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T15:03:49Z.
Review: APPROVED
Reviewed exact head
edeac65600f4bc780320905a47f43b8c5bfb029cagainst currentmain2ee8e9751a06bd4cb7edb8d17f433d56a39a7025.The three
PlainWhatmappings match the strings documented from PPSA21564's bundledlibc.prx;bad_array_new_lengthcorrectly sharesbad_alloc'sbad allocationtext. The updated guest test expectations match those outputs, while the existing__sce_v2bad-function-call mapping remains unchanged. I found no issue in the changed paths. The overlap scan reports no open-PR overlap; the current-main merge preview is clean, and none of the intervening main commits changes these three paths.Local verification: Release build of
guest_sce_v2_exceptions_tests,guest_bad_optional_access_tests, andexception_runtime_testssucceeded. Those three CTests passed three repetitions each (9/9).check_conventions.pyandgit diff --checkpassed. Hosted Windows, Ubuntu relinker, Ubuntu register-context, ASan relinker, conventions, eligibility, intake, labels, and report checks pass; Linux product is skipped, and macOS jobs remain queued. I could not run the MinGW-onlyguest_message_destructor_abion this Linux host; hosted Windows does not build that guest-linked test. No PS5 title run was performed.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-28T15:25:03Z.
Review: APPROVED
Approving head
edeac65600. I read the diff and ran firmware 13.42'sstd::bad_alloc::what(xvRvFtnUk3E) andstd::bad_function_call::what(XVu4--EWzcM): the decrypted systemlibSceLibcInternal.sprx's exports, natively on a PC (not a console). Three identical runs.They return
"bad allocation"and"bad function call", the strings this change uses (the updated tests check thebad allocationone), so the system module agrees with the PPSA21564libc.prxreading in the description. I did not checkbad_array_new_length's vtable or the unchanged classes in the module.