libkernel: coredump user-data and attach calls answered as outside-the-handler; WriteUserString still unsettled (Broken Sword); branch ready #4144

Closed
opened 2026-10-12 00:01:30 +00:00 by screamm · 1 comment
screamm commented 2026-10-12 00:01:30 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:01:30Z.


libkernel's coredump user-data calls throw. Broken Sword Reforged (PPSA21480, #3704 comment 6113687542) reaches sceCoredumpWriteUserString not implemented from its fatal path; 007 First Light (PPSA11386) imports sceCoredumpWriteUserData. This branch settles the four calls the public sources define and leaves the five they do not, including WriteUserString itself, so it does not move Broken Sword (whose real blocker is the agc_graphics.cpp:266 error before the dump).

Branch ready: screamm:feat/libkernel-coredump-user-data (two commits on main bab7b328, head 9205b15b: feat(libkernel): implement the coredump user-data calls, feat(libkernel): answer the coredump user-file attach calls). I cannot open it as a PR under the intake rule; anyone eligible is welcome to carry it, keeping the commits as they are. It overlaps textually with open #3821 (same constant and a near-identical region-check helper at the top of Coredump.cpp); whichever lands second needs a small rebase.

  • The sources agree that user data is written only from inside the registered coredump handler: shadPS4's coredump_error.h has exactly PARAM, NOT_REGISTERED, ALREADY_REGISTERED, NOT_IN_COREDUMP_HANDLER, THREAD_CREATE and STOP_INFO_UNAVAILABLE, and the Vita header for the same API documents "No user-data capture is active" outside the handler. The handler is never invoked here, so sceCoredumpWriteUserData(const void*, size_t) (returns ssize_t), sceCoredumpAttachUserFile(uint32_t, const char*) and sceCoredumpAttachMemoryRegionAsUserFile(uint32_t, const void*, size_t, const char*) return SCE_COREDUMP_ERROR_NOT_IN_COREDUMP_HANDLER (0x81180003, the model open #3821 also uses) and store nothing; sceCoredumpDebugTextOut(const char*, int) prints to stderr with the existing [coredump] prefix. Signatures from Orbital db_types.json and SharpProspero KernelSystem.cs (facts only). A null, empty or wrapping region, a null path/name/text or a negative length throw, because the console's check order is unknown. The 0x81180003 value is PS4 numbering, unconfirmed on PS5; recorded in TechnicalDebt.
  • Still throwing, with the reason in TechnicalDebt: sceCoredumpWriteUserString (no declaration in any public source; a register capture at Broken Sword's call would settle it), sceCoredumpSetUserDataType, sceCoredumpGetStopInfoGpu_Agc (no signatures), sceCoredumpGetStopInfoCpu and sceCoredumpGetThreadContextInfo (outside the handler the console could return either of two codes).
  • New guest_coredump_user_data checks the returns before registering, while registered, from another thread and after unregistering, every throw case, and that the caller's buffer is untouched.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs (with open #4021's Socket.cpp guard applied locally, since main does not compile on MinGW without it): guest_coredump_user_data 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 581/584, the failures being the known Windows failures on current main (agc_write_tracking #4087, guest_kernel_stack_protect #4088, agc_driver #3171); tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5806453183 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4144). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T00:01:30Z. --- libkernel's coredump user-data calls throw. Broken Sword Reforged (PPSA21480, #3704 comment 6113687542) reaches `sceCoredumpWriteUserString not implemented` from its fatal path; 007 First Light (PPSA11386) imports `sceCoredumpWriteUserData`. This branch settles the four calls the public sources define and leaves the five they do not, including `WriteUserString` itself, so it does not move Broken Sword (whose real blocker is the `agc_graphics.cpp:266` error before the dump). **Branch ready:** [`screamm:feat/libkernel-coredump-user-data`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-coredump-user-data) (two commits on `main` `bab7b328`, head `9205b15b`: `feat(libkernel): implement the coredump user-data calls`, `feat(libkernel): answer the coredump user-file attach calls`). I cannot open it as a PR under the intake rule; anyone eligible is welcome to carry it, keeping the commits as they are. It overlaps textually with open #3821 (same constant and a near-identical region-check helper at the top of `Coredump.cpp`); whichever lands second needs a small rebase. - The sources agree that user data is written only from inside the registered coredump handler: shadPS4's `coredump_error.h` has exactly `PARAM`, `NOT_REGISTERED`, `ALREADY_REGISTERED`, `NOT_IN_COREDUMP_HANDLER`, `THREAD_CREATE` and `STOP_INFO_UNAVAILABLE`, and the Vita header for the same API documents "No user-data capture is active" outside the handler. The handler is never invoked here, so `sceCoredumpWriteUserData(const void*, size_t)` (returns `ssize_t`), `sceCoredumpAttachUserFile(uint32_t, const char*)` and `sceCoredumpAttachMemoryRegionAsUserFile(uint32_t, const void*, size_t, const char*)` return `SCE_COREDUMP_ERROR_NOT_IN_COREDUMP_HANDLER` (0x81180003, the model open #3821 also uses) and store nothing; `sceCoredumpDebugTextOut(const char*, int)` prints to stderr with the existing `[coredump]` prefix. Signatures from Orbital `db_types.json` and SharpProspero `KernelSystem.cs` (facts only). A null, empty or wrapping region, a null path/name/text or a negative length throw, because the console's check order is unknown. The 0x81180003 value is PS4 numbering, unconfirmed on PS5; recorded in TechnicalDebt. - Still throwing, with the reason in TechnicalDebt: `sceCoredumpWriteUserString` (no declaration in any public source; a register capture at Broken Sword's call would settle it), `sceCoredumpSetUserDataType`, `sceCoredumpGetStopInfoGpu_Agc` (no signatures), `sceCoredumpGetStopInfoCpu` and `sceCoredumpGetThreadContextInfo` (outside the handler the console could return either of two codes). - New `guest_coredump_user_data` checks the returns before registering, while registered, from another thread and after unregistering, every throw case, and that the caller's buffer is untouched. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs` (with open #4021's `Socket.cpp` guard applied locally, since `main` does not compile on MinGW without it): `guest_coredump_user_data` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 581/584, the failures being the known Windows failures on current `main` (`agc_write_tracking` #4087, `guest_kernel_stack_protect` #4088, `agc_driver` #3171); `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
oneandonlydean commented 2026-10-13 07:37:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:37:53Z.


Closing: both commits of the branch are on main (#3821, #4197). sceCoredumpWriteUserString still throws; reopen when there is a source for its signature.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140707914 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4144#issuecomment-6140707914). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T07:37:53Z. --- Closing: both commits of the branch are on main (#3821, #4197). `sceCoredumpWriteUserString` still throws; reopen when there is a source for its signature.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#4144
No description provided.