fix(libkernel): accept any block size and a null block in the system software version getters as measured on a PS5 #11025

Merged
orezraey merged 3 commits from upstream-pr/11025 into main 2026-10-26 21:59:22 +00:00
orezraey commented 2026-10-25 14:23:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-25T14:23:44Z.


What

sceKernelGetProsperoSystemSwVersion and sceKernelGetSystemSwVersion measured on a retail PS5 (firmware 13.60) with two homebrew probes calling libkernel.sprx and libkernel_sys.sprx from a payload process (both libraries resolve to the same address). The sources and console logs are in this gist (pswprospero, pswsystem).

sceKernelGetProsperoSystemSwVersion returned EINVAL without writing for any leading size other than 0x28. On the console every size returns 0: 0, 0x27, 0x28, 0x29, 0x30, 0x100 and 2^64-1. The size field is left as given, bytes 8 to 0x27 are written (the string and the packed version at 0x24) and nothing from 0x28 onward changes. The size check is gone.

A null block returned EFAULT from both functions. On the console both return 0 without a fault and without touching errno. Both now return 0 without writing.

Already matching, now recorded: sceKernelGetSystemSwVersion ignores the size field on 13.60 too (values 0, 1, 0x18, 0x27 to 0x30, 0x40, 0x1000 and 2^64-1), and still reports "13.590.001" while the Prospero variant reports "13.600.007", as it did on 13.42. The version AnyPS5 reports stays 0x01000000 ("01.000.000"); the console's firmware version is still not modeled.

Before and after

| Case | PS5 | AnyPS5 before | AnyPS5 now |

|---|---|---|---|

| sceKernelGetProsperoSystemSwVersion with a size other than 0x28 | 0, bytes 8 to 0x27 written | EINVAL, nothing written | 0, bytes 8 to 0x27 written |

| null block, both functions | 0, no fault | EFAULT | 0 |

| sceKernelGetSystemSwVersion with any size | ignores the size | the same | the same |

| version reported | the console's firmware | "01.000.000" | "01.000.000" (debt) |

Tested

Head 83780cc1a0 (main 4da123784e merged in, after #9171 landed), Windows 11 Pro 26200, WinLibs GCC 15.2, Release.

  • guest_software_version checks a null block (0, errno unchanged) and sizes 0, 0x18, 0x27, 0x28, 0x29, 0x30, 0x100 and 2^64-1: each returns 0, keeps the size, writes "01.000.000" and 0x01000000, and leaves 0x40 bytes after the block untouched.

  • guest_system_configuration checks a null block (0) and sizes 0, 1, 24, 39 to 41, 48, 64, 0x1000 and 2^64-1.

  • Both pass three runs in a row; on the previous code both fail (the null cases expected EFAULT, and the Prospero sizes EINVAL).

  • At 65172ff414 (main a4f0c002da merged in; the only conflict was the docs/dev/debt/libkernel.md line next to the new setlogin entry, both kept) both tests pass three runs in a row on Windows and on Linux (WSL build tree, same targets).

  • tools/check_conventions.py passes.

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 (#9693 landed first; its setlogin entry is kept next to this one since 65172ff414)

  • Fixes: none

  • Unblocks: none

  • GPUs tested: n/a

  • AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5005576499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11025). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-25T14:23:44Z. --- ### What `sceKernelGetProsperoSystemSwVersion` and `sceKernelGetSystemSwVersion` measured on a retail PS5 (firmware 13.60) with two homebrew probes calling `libkernel.sprx` and `libkernel_sys.sprx` from a payload process (both libraries resolve to the same address). The sources and console logs are in [this gist](https://gist.github.com/orezraey/1b8c9379ea1452bdafe1ea5b378b47a5) (`pswprospero`, `pswsystem`). **`sceKernelGetProsperoSystemSwVersion`** returned `EINVAL` without writing for any leading size other than 0x28. On the console every size returns 0: 0, 0x27, 0x28, 0x29, 0x30, 0x100 and 2^64-1. The size field is left as given, bytes 8 to 0x27 are written (the string and the packed version at 0x24) and nothing from 0x28 onward changes. The size check is gone. **A null block** returned `EFAULT` from both functions. On the console both return 0 without a fault and without touching `errno`. Both now return 0 without writing. **Already matching, now recorded:** `sceKernelGetSystemSwVersion` ignores the size field on 13.60 too (values 0, 1, 0x18, 0x27 to 0x30, 0x40, 0x1000 and 2^64-1), and still reports "13.590.001" while the Prospero variant reports "13.600.007", as it did on 13.42. The version AnyPS5 reports stays `0x01000000` ("01.000.000"); the console's firmware version is still not modeled. **Before and after** | Case | PS5 | AnyPS5 before | AnyPS5 now | |---|---|---|---| | `sceKernelGetProsperoSystemSwVersion` with a size other than 0x28 | 0, bytes 8 to 0x27 written | `EINVAL`, nothing written | 0, bytes 8 to 0x27 written | | null block, both functions | 0, no fault | `EFAULT` | 0 | | `sceKernelGetSystemSwVersion` with any size | ignores the size | the same | the same | | version reported | the console's firmware | "01.000.000" | "01.000.000" (debt) | ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Head `83780cc1a0` (`main` `4da123784e` merged in, after #9171 landed), Windows 11 Pro 26200, WinLibs GCC 15.2, Release. - `guest_software_version` checks a null block (0, `errno` unchanged) and sizes 0, 0x18, 0x27, 0x28, 0x29, 0x30, 0x100 and 2^64-1: each returns 0, keeps the size, writes "01.000.000" and `0x01000000`, and leaves 0x40 bytes after the block untouched. - `guest_system_configuration` checks a null block (0) and sizes 0, 1, 24, 39 to 41, 48, 64, 0x1000 and 2^64-1. - Both pass three runs in a row; on the previous code both fail (the null cases expected `EFAULT`, and the Prospero sizes `EINVAL`). - At `65172ff414` (`main` `a4f0c002da` merged in; the only conflict was the `docs/dev/debt/libkernel.md` line next to the new `setlogin` entry, both kept) both tests pass three runs in a row on Windows and on Linux (WSL build tree, same targets). - `tools/check_conventions.py` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 (#9693 landed first; its `setlogin` entry is kept next to this one since `65172ff414`) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 14:26:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T14:26:17Z.

Review: COMMENTED


The PS5 probe source and logs support the size and null-pointer results claimed here. My local checks passed: git diff --check, tools/check_conventions.py, and C++20 syntax checks for the changed implementation and test files. The hosted conventions, intake, labels and report checks pass; product build/test jobs are skipped, and I could not run the linked library test locally because the SDL2 submodule and XRandR development support are unavailable.

One integration item remains before I can approve: CONTRIBUTING.md says authors should agree the merge order for overlapping files. This PR proposes #9171 first and records it in Depends on, but I do not yet see confirmation from #9171's author. Please record that agreement; after #9171 lands, refresh this branch while preserving both debt entries.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643659543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11025#pullrequestreview-5643659543). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T14:26:17Z. **Review:** COMMENTED --- The PS5 probe source and logs support the size and null-pointer results claimed here. My local checks passed: `git diff --check`, `tools/check_conventions.py`, and C++20 syntax checks for the changed implementation and test files. The hosted conventions, intake, labels and report checks pass; product build/test jobs are skipped, and I could not run the linked library test locally because the SDL2 submodule and XRandR development support are unavailable. One integration item remains before I can approve: CONTRIBUTING.md says authors should agree the merge order for overlapping files. This PR proposes #9171 first and records it in `Depends on`, but I do not yet see confirmation from #9171's author. Please record that agreement; after #9171 lands, refresh this branch while preserving both debt entries.
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!11025
No description provided.