fix(libkernel): give sceCoredumpSetUserDataType its signature and result #8906

Merged
hypermoist merged 3 commits from upstream-pr/8906 into main 2026-10-22 20:41:20 +00:00
hypermoist commented 2026-10-21 05:29:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-21T05:29:50Z.


What

sceCoredumpSetUserDataType (NID Uxqkdta7wEg) was declared without parameters and threw NotImplemented. #4144 left it that way because no signature was known.

In the decrypted PS5 12.00 libkernel.sprx, the export at 0x138B0 is a single tail call:

  • It takes one int, sign-extends it, and passes it to syscall 601 (the coredump syscall the other sceCoredump* calls use) with command 29 and a third argument of 0.
  • The library does not translate the kernel's result: there is no 0x8118xxxx mapping, so a kernel error would return -1 with errno set by the shared syscall error stub. Whether the kernel rejects any type is decided inside the kernel and is not visible in the module or measured.

This PR gives it the (int type) signature and returns 0. The call only labels the user data of a core dump, and none is produced here. Upstream's sceCoredumpConfigDumpMode follows the same convention. Which types the kernel accepts is not measured; the new Silent stubs entry in docs/dev/debt/libkernel.md records this.

Titles: Palworld (PPSA23126, #2598) and Hello Neighbor (PPSA35154, discussion #6991) import it. In those reports it is listed among the imported stubs, not as the stop.

The body is written from this observed behaviour; nothing from the module is copied.

Tested

Linux (CachyOS, GCC, Release): full build. All 542 guest_*, kernel and Ampr tests pass. guest_coredump_user_data now checks that type 0 returns 0. It no longer asserts success for other values, since the kernel's accepted range is not measured.

tools/check_conventions.py is clean. No open PR touches the name or NID. A three-way merge against every open PR touching these files adds no conflicts; the debt line's position was chosen for that, since about 70 open PRs edit libkernel.md.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code), reviewed by the contributor

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4946881185 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-21T05:29:50Z. --- ### What `sceCoredumpSetUserDataType` (NID `Uxqkdta7wEg`) was declared without parameters and threw `NotImplemented`. #4144 left it that way because no signature was known. In the decrypted PS5 12.00 `libkernel.sprx`, the export at 0x138B0 is a single tail call: - It takes one `int`, sign-extends it, and passes it to syscall 601 (the coredump syscall the other `sceCoredump*` calls use) with command 29 and a third argument of 0. - The library does not translate the kernel's result: there is no `0x8118xxxx` mapping, so a kernel error would return -1 with `errno` set by the shared syscall error stub. Whether the kernel rejects any `type` is decided inside the kernel and is not visible in the module or measured. This PR gives it the `(int type)` signature and returns 0. The call only labels the user data of a core dump, and none is produced here. Upstream's `sceCoredumpConfigDumpMode` follows the same convention. Which types the kernel accepts is not measured; the new Silent stubs entry in `docs/dev/debt/libkernel.md` records this. Titles: Palworld (PPSA23126, #2598) and Hello Neighbor (PPSA35154, discussion #6991) import it. In those reports it is listed among the imported stubs, not as the stop. The body is written from this observed behaviour; nothing from the module is copied. ### Tested Linux (CachyOS, GCC, Release): full build. All 542 `guest_*`, kernel and Ampr tests pass. `guest_coredump_user_data` now checks that type 0 returns 0. It no longer asserts success for other values, since the kernel's accepted range is not measured. `tools/check_conventions.py` is clean. No open PR touches the name or NID. A three-way merge against every open PR touching these files adds no conflicts; the debt line's position was chosen for that, since about 70 open PRs edit `libkernel.md`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code), reviewed by the contributor 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
github-actions[bot] commented 2026-10-21 05:30:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T05:30:37Z.


Progress report (6ef5a1c → 1f8d476)

📈 System libraries: 42.34% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceCoredumpSetUserDataType
⚪ 1 behaviourally empty (constant return or throw)
Library Name
libkernel sceCoredumpSetUserDataType
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308828909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#issuecomment-6308828909). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T05:30:37Z. --- <!-- progress-report --> ### Progress report (6ef5a1c → 1f8d476) 📈 **System libraries**: 42.34% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `sceCoredumpSetUserDataType` | </details> <details> <summary>⚪ 1 behaviourally empty (constant return or throw)</summary> | Library | Name | | - | - | | libkernel | `sceCoredumpSetUserDataType` | </details>
MarcZX10 commented 2026-10-21 05:30:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:30:52Z.


I compiled the PR revision’s Coredump.cpp with the existing GuestCoredumpUserData.cpp test on Linux using GCC -Wall -Wextra -Werror; the executable passed. git diff --check upstream/main...refs/codex/pr-8906 also passes. This was a focused host harness, not a full project build or independent console measurement.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308832225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#issuecomment-6308832225). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T05:30:52Z. --- I compiled the PR revision’s `Coredump.cpp` with the existing `GuestCoredumpUserData.cpp` test on Linux using GCC `-Wall -Wextra -Werror`; the executable passed. `git diff --check upstream/main...refs/codex/pr-8906` also passes. This was a focused host harness, not a full project build or independent console measurement.
MarcZX10 commented 2026-10-21 05:30:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:30:53Z.

Review: APPROVED


Reviewed the observed (int) export signature, no-op behavior documented for the emulator’s absent core-dump path, and regression coverage. The changed implementation and existing coredump test compile cleanly with GCC strict warnings and pass on Linux. This approval is scoped to the focused implementation and local test; the console probe described in the PR was not independently reproduced.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5595343255 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#pullrequestreview-5595343255). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T05:30:53Z. **Review:** APPROVED --- Reviewed the observed `(int)` export signature, no-op behavior documented for the emulator’s absent core-dump path, and regression coverage. The changed implementation and existing coredump test compile cleanly with GCC strict warnings and pass on Linux. This approval is scoped to the focused implementation and local test; the console probe described in the PR was not independently reproduced.
MarcZX10 commented 2026-10-21 05:42:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:42:22Z.

Review: COMMENTED


Could you clarify the return contract for unsupported type values? The PR description says the syscall result comes back unchanged, but this implementation returns 0 for every int, and the test locks in success for -1 and INT_MAX. “No dump is produced here” does not by itself establish that the kernel accepts every value; the syscall may still validate its command argument. If the observed result is genuinely unconditional success, please document that evidence. Otherwise, narrowing the test to measured values (or leaving the export unmodeled until the accepted range is known) would avoid asserting unverified behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5595415968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#pullrequestreview-5595415968). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T05:42:22Z. **Review:** COMMENTED --- Could you clarify the return contract for unsupported `type` values? The PR description says the syscall result comes back unchanged, but this implementation returns 0 for every `int`, and the test locks in success for `-1` and `INT_MAX`. “No dump is produced here” does not by itself establish that the kernel accepts every value; the syscall may still validate its command argument. If the observed result is genuinely unconditional success, please document that evidence. Otherwise, narrowing the test to measured values (or leaving the export unmodeled until the accepted range is known) would avoid asserting unverified behavior.
hypermoist commented 2026-10-21 06:52:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-21T06:52:54Z.


Good point. The module only shows the user-space side: type is passed to the kernel unchanged, and the result isn't translated. Whether the kernel rejects some values happens inside the kernel; it isn't visible in libkernel and I haven't measured it. So there's no evidence for unconditional success. In fde789cca8 the test only asserts type 0, and I corrected the description to say the accepted range is unknown. The call itself still returns 0, as recorded under Silent stubs, since no dump is produced here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309976283 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#issuecomment-6309976283). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-21T06:52:54Z. --- Good point. The module only shows the user-space side: `type` is passed to the kernel unchanged, and the result isn't translated. Whether the kernel rejects some values happens inside the kernel; it isn't visible in libkernel and I haven't measured it. So there's no evidence for unconditional success. In fde789cca8 the test only asserts type 0, and I corrected the description to say the accepted range is unknown. The call itself still returns 0, as recorded under Silent stubs, since no dump is produced here.
xXPBSXx commented 2026-10-21 07:44:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T07:44:18Z.


Windows data point for fde789cca merged onto main 86b84244f (clean, git merge-tree rc 0): Windows 10.0.19045, MinGW-w64 GCC 15.2.0, Release. ctest -N -R '^guest_coredump_user_data$' lists exactly that one test; ctest --no-tests=error -R '^guest_coredump_user_data$' was run three times per tree.

  • With the PR: passes 3 of 3 (0.06-0.09 s).
  • Same tree with core/libs/prx/libkernel/System/src/Coredump.cpp restored to main (the new test cases kept): fails 3 of 3, exit code 0xc0000409 (the test process aborts).
    Not tested: other platforms, a title run.
    AI-assisted (Claude Code).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310800022 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#issuecomment-6310800022). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T07:44:18Z. --- Windows data point for `fde789cca` merged onto `main` `86b84244f` (clean, `git merge-tree` rc 0): Windows 10.0.19045, MinGW-w64 GCC 15.2.0, Release. `ctest -N -R '^guest_coredump_user_data$'` lists exactly that one test; `ctest --no-tests=error -R '^guest_coredump_user_data$'` was run three times per tree. - With the PR: passes 3 of 3 (0.06-0.09 s). - Same tree with `core/libs/prx/libkernel/System/src/Coredump.cpp` restored to `main` (the new test cases kept): fails 3 of 3, exit code `0xc0000409` (the test process aborts). Not tested: other platforms, a title run. AI-assisted (Claude Code).
hypermoist commented 2026-10-22 09:11:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T09:11:04Z.


@xXPBSXx thanks for the Windows run and its control. After merging main, the parameter is now std::int32_t type to match main's declaration, and the test still checks only type 0.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337100426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8906#issuecomment-6337100426). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-22T09:11:04Z. --- @xXPBSXx thanks for the Windows run and its control. After merging `main`, the parameter is now `std::int32_t type` to match `main`'s declaration, and the test still checks only type 0.
Sign in to join this conversation.
No reviewers
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!8906
No description provided.