fix(libc): give abort and __stack_chk_fail the guest calling convention #17900
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17900"
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 klosixgaming-arch on 2026-11-09T21:19:25Z.
What
abortand__stack_chk_failare defined in libc'sProcess.cppwithoutAPS5_VABI(on the console__stack_chk_failis a libkernel export; here it is defined in libc). On Windows that makes them Microsoft x64 functions called by SysV guest code. Both never return, so this has no visible effect: the change is for consistency with the guest convention and so the tools see the two exports. On Linux and macOSAPS5_VABIis empty and the generated code is unchanged.The definitions now have
APS5_VABI, and so does theabort_nid_postfixdeclaration inBoundsChecking.cpp, which calls it. Clang rejects asysv_abidefinition after a declaration without it, so the two have to change together.The tools find exports through their
APS5_VABIdefinitions, so on maintools/progress.pydoes not count these two,tools/nid_names.py --where --name abort __stack_chk_failfinds neither (both with this branch), andpr_overlap.py's export pattern misses them.tools/progress.py --module libc --compareon main and this branch: libc 1738/1746 -> 1740/1748.A scan of
core/libsfor_nid_postfixfunction definitions withoutAPS5_VABIwhose names are in aerolib found these two and_ZSt17iostream_categoryv, which #14796 already changes, so it is left out here.Tested
Ubuntu 24.04, GCC 13.3, Release,
BUILD_TESTING=ON(configured with the SDL XRandR and audio checks relaxed locally for missing dev packages; no SDL code was built): libc, libkernel, libSceLibcInternal andguest_signal_testsbuild, andctest -R guest_signalspasses.A throwaway program linked against the unpatched libraries forks, installs a guest SIGABRT handler with
sigaction_nid_postfixand callsabort_nid_postfix. With the default disposition the process ends by SIGABRT. A handler that returns runs, then the process ends by SIGABRT. A handler thatsiglongjmps out runs and the process continues. With SIGABRT blocked through_sigprocmask_nid_postfixthe handler does not run and the process ends by SIGABRT, where FreeBSD 11.4'sabortunblocks it first; that is unchanged here. On LinuxAPS5_VABIis empty, so this shows the existing behaviour, not a change.Windows, the only platform where the generated code changes: JJenkx's run below (Windows 11 22621, WinLibs GCC 15.2 UCRT, Release,
47b83fbmerged ontof439f7f) builds and passes the libc tests in 3 of 3 runs. No test callsabort_nid_postfixor__stack_chk_fail_nid_postfix, so that run shows the change builds and nothing else regresses, not the two functions themselves.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pycould not run here; open libc PRs were checked by hand. #9162, which the overlap report could not compare, changes onlyWaitChildProcess_nid_no_patchinProcess.cpp.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-11-22T11:44:43Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
47b83fb894408503f4ab0873a03617f71a4bae9aand the prepared diff. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run independently. I read
core/libs/prx/libc/src/BoundsChecking.cpp,core/libs/prx/libc/src/Process.cpp, andcore/libs/prx/libc/include/general/VabiMacros.hpp. The manifest lists two changed files and both full texts were available and read; no changed files were excluded. The description's reported build and test results were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T16:56:10Z.
Review: COMMENTED
Both changed translation units passed the MinGW UCRT syntax check. The guest calling-convention annotation now agrees between the
abort_nid_postfixdefinition and the declaration inBoundsChecking.cpp. I checked the declarations and compilation, with runtime abort and stack-check handling still unverified on Windows.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.