fix(libkernel): return EFAULT from sceKernelWriteThrottlingStatus for a null status #7133

Merged
pushkarreddyy merged 1 commit from upstream-pr/7133 into main 2026-10-17 20:45:24 +00:00
pushkarreddyy commented 2026-10-17 13:03:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T13:03:22Z.


What

sceKernelWriteThrottlingStatus currently throws an unhandled exception (std::invalid_argument) when passed a null status buffer pointer. On FreeBSD / PS5 libkernel, kernel system calls receiving an invalid or null user pointer return SceErrorFromErrno(GUEST_EFAULT) (0x8002000e).

This change:

  • Replaces the throw with returning SceErrorFromErrno(GUEST_EFAULT) when status == nullptr.
  • Adds a unit test in core/libs/tests/GuestFilesystem.cpp verifying sceKernelWriteThrottlingStatus(nullptr) returns 0x8002000e.
  • Updates docs/dev/debt/libkernel.md documenting the null status pointer EFAULT return.

Tested

  • Windows 11, GCC 15 (MinGW-w64), Release build.
  • python tools/check_conventions.py --base origin/main: 0 findings, 0 errors.

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: PPSA17221 #5744
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4900275685 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7133). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T13:03:22Z. --- ### What `sceKernelWriteThrottlingStatus` currently throws an unhandled exception (`std::invalid_argument`) when passed a null status buffer pointer. On FreeBSD / PS5 `libkernel`, kernel system calls receiving an invalid or null user pointer return `SceErrorFromErrno(GUEST_EFAULT)` (`0x8002000e`). This change: - Replaces the throw with returning `SceErrorFromErrno(GUEST_EFAULT)` when `status == nullptr`. - Adds a unit test in `core/libs/tests/GuestFilesystem.cpp` verifying `sceKernelWriteThrottlingStatus(nullptr)` returns `0x8002000e`. - Updates `docs/dev/debt/libkernel.md` documenting the null status pointer `EFAULT` return. ### Tested - Windows 11, GCC 15 (MinGW-w64), Release build. - `python tools/check_conventions.py --base origin/main`: 0 findings, 0 errors. ### 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: PPSA17221 #5744 - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-17 13:14:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T13:14:32Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6228 docs/dev/debt/libkernel.md L123-124

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libkernel/File/src/Stdio.cpp
docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestFilesystem.cpp
PR 6222 core/libs/prx/libkernel/File/src/Stdio.cpp
docs/dev/debt/libkernel.md
PR 6287 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6510 docs/dev/debt/libkernel.md
PR 6710 docs/dev/debt/libkernel.md
PR 6962 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/File/src/Stdio.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234311148 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7133#issuecomment-6234311148). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-17T13:14:32Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6228](https://www.github.com/boykopovar/AnyPS5/pull/6228) | `docs/dev/debt/libkernel.md` [L123-124](https://github.com/boykopovar/AnyPS5/blob/66702f1cffd3646f2d674ed093fde0a85a70761f/docs/dev/debt/libkernel.md#L123-L124) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/File/src/Stdio.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestFilesystem.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libkernel/File/src/Stdio.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6287](https://www.github.com/boykopovar/AnyPS5/pull/6287) | `core/libs/prx/libkernel/File/src/Stdio.cpp` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `docs/dev/debt/libkernel.md` | | [PR 6710](https://www.github.com/boykopovar/AnyPS5/pull/6710) | `docs/dev/debt/libkernel.md` | | [PR 6962](https://www.github.com/boykopovar/AnyPS5/pull/6962) | `docs/dev/debt/libkernel.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/File/src/Stdio.cpp` |
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!7133
No description provided.