feat(libSceSysmodule): scope PS4-only module IDs to PS4 processes #18141

Closed
pushkarreddyy wants to merge 7 commits from upstream-pr/18141 into main
pushkarreddyy commented 2026-11-10 15:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-11-10T15:37:16Z.


What

Grand Theft Auto V (CUSA00419 v01.57, bring-up discussion #18084 blocker 6) asserts with int 0x41 at eboot address 0x1b45414 after 4.8 seconds:

The title's own assert (int 0x41) after 4.8 s (main 70aab1bf93 + #16882; found in a traced start):
at eboot address 0x1b45414 it calls sceSysmoduleLoadModule(0x97) (libSceNpParty), gets 0x805A1000, and asserts.

In core/libs/prx/libSceSysmodule/ModuleTable.hpp, kPublicModuleIds holds the 141 module IDs accepted in payload processes on a PS5. However, PS4 processes running under backwards compatibility also call sceSysmoduleLoadModule with IDs that were public on PS4 but omitted from PS5: 0x0097 (libSceNpParty), 0x00a2 (libSceInvitationDialog), and 0x00b2 (libSceNpProfileDialog).

  • Scope PS4 module IDs 0x0097, 0x00a2, and 0x00b2 to PS4 processes via sceKernelIsPs4Process() in core/libs/prx/libSceSysmodule/Export.cpp.
  • Keep kPublicModuleIds in core/libs/prx/libSceSysmodule/ModuleTable.hpp strictly at the 141 PS5 baseline elements.
  • Document PS4 process module ID acceptance under Silent stubs in docs/dev/debt/libSceSysmodule.md.
  • Update core/libs/tests/GuestSysmodule.cpp to test rejection of PS4 IDs in standard PS5 processes and acceptance when running as a PS4 child process.

Tested

  • python tools/check_conventions.py --base origin/main (passed: 0 findings).
  • guest_sysmodule unit tests covering full-range ID sets across PS5 and PS4 processes.

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: Fixes #18138
  • Unblocks: CUSA00419 #18084
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5244104257 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18141). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-10T15:37:16Z. --- ### What Grand Theft Auto V (CUSA00419 v01.57, bring-up discussion #18084 blocker 6) asserts with `int 0x41` at eboot address `0x1b45414` after 4.8 seconds: ```text The title's own assert (int 0x41) after 4.8 s (main 70aab1bf93 + #16882; found in a traced start): at eboot address 0x1b45414 it calls sceSysmoduleLoadModule(0x97) (libSceNpParty), gets 0x805A1000, and asserts. ``` In `core/libs/prx/libSceSysmodule/ModuleTable.hpp`, `kPublicModuleIds` holds the 141 module IDs accepted in payload processes on a PS5. However, PS4 processes running under backwards compatibility also call `sceSysmoduleLoadModule` with IDs that were public on PS4 but omitted from PS5: `0x0097` (`libSceNpParty`), `0x00a2` (`libSceInvitationDialog`), and `0x00b2` (`libSceNpProfileDialog`). - Scope PS4 module IDs `0x0097`, `0x00a2`, and `0x00b2` to PS4 processes via `sceKernelIsPs4Process()` in `core/libs/prx/libSceSysmodule/Export.cpp`. - Keep `kPublicModuleIds` in `core/libs/prx/libSceSysmodule/ModuleTable.hpp` strictly at the 141 PS5 baseline elements. - Document PS4 process module ID acceptance under Silent stubs in `docs/dev/debt/libSceSysmodule.md`. - Update `core/libs/tests/GuestSysmodule.cpp` to test rejection of PS4 IDs in standard PS5 processes and acceptance when running as a PS4 child process. ### Tested - `python tools/check_conventions.py --base origin/main` (passed: 0 findings). - `guest_sysmodule` unit tests covering full-range ID sets across PS5 and PS4 processes. ### 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 - [x] Fixes: Fixes #18138 - [x] Unblocks: CUSA00419 #18084 - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-10 20:27:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-10T20:27:15Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 48ff76ed16:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_sysmodule_tests built cleanly.
  • CTest (guest_sysmodule, guest_sysmodule_maps_scan):
    1/2 Test #3910: guest_sysmodule ..................   Passed    0.08 sec
    2/2 Test #3911: guest_sysmodule_maps_scan ........   Passed    0.08 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libSceSysmodule/ModuleTable.hpp reverted to main and the new tests kept, the suite fails:
    1/2 Test #3911: guest_sysmodule_maps_scan ........Subprocess aborted***Exception:   1.50 sec
    2/2 Test #3910: guest_sysmodule ..................Subprocess aborted***Exception:   1.60 sec
    0% tests passed, 2 tests failed out of 2
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified sorted order in kPublicModuleIds in core/libs/prx/libSceSysmodule/ModuleTable.hpp (0x0096 < 0x0097 < 0x0098) ensuring std::binary_search in isPublicModuleId operates correctly without partition violations.
    • Verified kAccepted array in core/libs/tests/GuestSysmodule.cpp matches kPublicModuleIds, maintaining ascending order and passing the static_assert size check (142 elements).
    • Verified sceSysmoduleLoadModule, sceSysmoduleUnloadModule, and sceSysmoduleIsLoaded return expected error codes (SCE_SYSMODULE_ERROR_UNLOADED / 0x805A1001) and success (0) across the libSceNpParty lifecycle.
    • Verified thread safety under gMutex and immutable const/constexpr properties of kPublicModuleIds across LP64 (Linux) and LLP64 (Windows) data models.
    • Verified strict compliance with AGENTS.md conventions: zero comments introduced, no title-specific special-casing, and no extraneous files added.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5848829038 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18141#pullrequestreview-5848829038). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-10T20:27:15Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `48ff76ed16`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_sysmodule_tests` built cleanly. - **CTest** (`guest_sysmodule`, `guest_sysmodule_maps_scan`): ``` 1/2 Test #3910: guest_sysmodule .................. Passed 0.08 sec 2/2 Test #3911: guest_sysmodule_maps_scan ........ Passed 0.08 sec 100% tests passed, 0 tests failed out of 2 ``` - **Negative control**: with `core/libs/prx/libSceSysmodule/ModuleTable.hpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/2 Test #3911: guest_sysmodule_maps_scan ........Subprocess aborted***Exception: 1.50 sec 2/2 Test #3910: guest_sysmodule ..................Subprocess aborted***Exception: 1.60 sec 0% tests passed, 2 tests failed out of 2 ``` Restoring the change makes it pass again. - **Code reading**: - Verified sorted order in kPublicModuleIds in core/libs/prx/libSceSysmodule/ModuleTable.hpp (0x0096 < 0x0097 < 0x0098) ensuring std::binary_search in isPublicModuleId operates correctly without partition violations. - Verified kAccepted array in core/libs/tests/GuestSysmodule.cpp matches kPublicModuleIds, maintaining ascending order and passing the static_assert size check (142 elements). - Verified sceSysmoduleLoadModule, sceSysmoduleUnloadModule, and sceSysmoduleIsLoaded return expected error codes (SCE_SYSMODULE_ERROR_UNLOADED / 0x805A1001) and success (0) across the libSceNpParty lifecycle. - Verified thread safety under gMutex and immutable const/constexpr properties of kPublicModuleIds across LP64 (Linux) and LLP64 (Windows) data models. - Verified strict compliance with AGENTS.md conventions: zero comments introduced, no title-specific special-casing, and no extraneous files added. - Note: the AI-assisted checkbox can stay. Looks Good To Me

Pull request closed

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!18141
No description provided.