fix(libkernel): ignore the input st_size of sceKernelGetModuleInfoFromAddr #3297

Merged
SynnZer0 merged 1 commit from upstream-pr/3297 into main 2026-10-11 08:45:22 +00:00
SynnZer0 commented 2026-10-11 06:04:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SynnZer0 on 2026-10-11T06:04:06Z.


What

sceKernelGetModuleInfoFromAddr no longer throws when the caller's st_size is not sizeof(ModuleInfoEx). It ignores the input value and, as before, writes the full size into the result. The flags != 2 check is unchanged.

PPSA21703 (Vampire Survivors, Unity) aborted with sceKernelGetModuleInfoFromAddr: unsupported st_size 983040 after its title screen. The only caller is the title's bundled libc.prx (import f7KBOafysXo, call at .text offset 0x3a869). It passes a 0x1A8-byte stack buffer (-0x1d8(%rbp) up to the stack guard at -0x30) and never stores to st_size before the call:

mov    %rdi,%r14
...
lea    -0x1d8(%rbp),%rdx      ; info, st_size not set
mov    %r14,%rdi              ; address
mov    $0x2,%esi              ; flags
call   sceKernelGetModuleInfoFromAddr

So the field holds whatever was on the stack, and the console cannot be requiring it on input. The previous check matched PPSA14632 only because its leftover stack value happened to be right.

  • Module/src/ModuleInfo.cpp: the st_size check is removed.
  • tests/GuestModuleInfo.cpp: the case that expected a throw for sizeof(ModuleInfoEx) - 8 now passes 0xf0000 and requires success with st_size == sizeof(ModuleInfoEx) written back.
  • docs/dev/TechnicalDebt.md: the entry no longer says that only the full st_size is accepted.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs 15.2.0posix-14.0.0-ucrt-r7), full build with BUILD_TESTING=ON:

  • ctest: 768/768 passed, including guest_module_info.
  • python tools/check_conventions.py --base origin/main: passed.
  • PPSA21703: before, the title aborted with this error after its first screen. After, it continues past that point and exits normally when closed.
  • Linux and macOS: not run. The change is not platform-specific.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4816982366 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3297). Originally posted by [SynnZer0](https://github.com/SynnZer0) on 2026-10-11T06:04:06Z. --- ### What `sceKernelGetModuleInfoFromAddr` no longer throws when the caller's `st_size` is not `sizeof(ModuleInfoEx)`. It ignores the input value and, as before, writes the full size into the result. The `flags != 2` check is unchanged. PPSA21703 (Vampire Survivors, Unity) aborted with `sceKernelGetModuleInfoFromAddr: unsupported st_size 983040` after its title screen. The only caller is the title's bundled `libc.prx` (import `f7KBOafysXo`, call at `.text` offset `0x3a869`). It passes a 0x1A8-byte stack buffer (`-0x1d8(%rbp)` up to the stack guard at `-0x30`) and never stores to `st_size` before the call: ``` mov %rdi,%r14 ... lea -0x1d8(%rbp),%rdx ; info, st_size not set mov %r14,%rdi ; address mov $0x2,%esi ; flags call sceKernelGetModuleInfoFromAddr ``` So the field holds whatever was on the stack, and the console cannot be requiring it on input. The previous check matched PPSA14632 only because its leftover stack value happened to be right. - `Module/src/ModuleInfo.cpp`: the `st_size` check is removed. - `tests/GuestModuleInfo.cpp`: the case that expected a throw for `sizeof(ModuleInfoEx) - 8` now passes `0xf0000` and requires success with `st_size == sizeof(ModuleInfoEx)` written back. - `docs/dev/TechnicalDebt.md`: the entry no longer says that only the full `st_size` is accepted. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs 15.2.0posix-14.0.0-ucrt-r7), full build with `BUILD_TESTING=ON`: - `ctest`: 768/768 passed, including `guest_module_info`. - `python tools/check_conventions.py --base origin/main`: passed. - PPSA21703: before, the title aborted with this error after its first screen. After, it continues past that point and exits normally when closed. - Linux and macOS: not run. The change is not platform-specific. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 06:04:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T06:04:15Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106076783 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3297#issuecomment-6106076783). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T06:04:15Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
adriadam10 commented 2026-10-11 08:45:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:45:18Z.


Checked: the removed st_size check, the updated test (fails on main, passes here), and the TechnicalDebt line. guest_module_info and the libkernel/libs ctest scope pass locally (99/99). shadPS4 and KytyPS5 also ignore the input st_size. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107258562 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3297#issuecomment-6107258562). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:45:18Z. --- Checked: the removed `st_size` check, the updated test (fails on `main`, passes here), and the TechnicalDebt line. `guest_module_info` and the libkernel/libs ctest scope pass locally (99/99). shadPS4 and KytyPS5 also ignore the input `st_size`. Merging.
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!3297
No description provided.