fix(libSceSysmodule): accept four PS4-only module ids in a PS4 process #18184
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18184"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adam25136 on 2026-11-10T18:31:57Z.
What
This PR makes
sceSysmoduleIsLoaded,sceSysmoduleLoadModuleandsceSysmoduleUnloadModulealso accept four PS4-only module ids in a PS4 process, whichsceKernelIsPs4Processreports for aCUSAtitle id: 0x97, 0xa2 and 0xb2, which GTA V loads, and 0xd7 (libSceDiscMap), which inFAMOUS Second Son loads (kPs4ModuleIdsinModuleTable.hpp). The first seven commits are pushkarreddyy's from #18141, unchanged apart from the rebases described under Tested: they add 0x97, 0xa2 and 0xb2 with their tests and debt entry. The debt entry gives each id's call site in GTA V, and #18141's description shows the title's assert when 0x97 fails. oneandonlydean closed #18141 as a duplicate of this PR. The last commit,983c302fd1(3 files, +3/−3), is this PR's own and adds 0xd7.inFAMOUS Second Son (CUSA00223 01.07) ships its own
libSceFios2.prx, which callssceSysmoduleLoadModule(0xd7)at 0x395ee duringsceFiosInitialize. When the call returns0x805A1000, FIOS2's setup fails and destroys its own locks, and the title crashes on one of them. With 0xd7 accepted, the title no longer crashes on a destroyed lock and stops next on thelibSceDiscMapfunctionfJgP+wqifno, which AnyPS5 doesn't implement yet (see Tested).ModuleTable.hpp: 0x00d7 joinskPs4ModuleIds. Like the other three, it is one of the 51 ids up to 0xffff thatkModuleTablenames andkPublicModuleIds, the 141 ids a PS5 process accepts, leaves out. It comes from the title's code and runs, not from a console. A PS5 process still rejects it. Ids joinkPs4ModuleIdsas titles are seen to load them, as oneandonlydean asked: "Ids can be added later when a title needs them."core/libs/tests/GuestSysmodule.cpp: 0x00d7 joins the test's copy of the list (kPs4Accepted). The sweep in the test's own process now checks that a PS5 process rejects it. The PS4 child checks that it is accepted and that it loads and unloads.docs/dev/debt/libSceSysmodule.md: the PS4-process entry now names four ids, 0xd7 among them with its call site, and says the other 47 of the 51 stay rejected.Before MarcZX10's review this PR carried all four ids itself. After it, the PR was rebuilt on #18141's head, which is how pushkarreddyy's commits came into it.
Tested
Windows 10 Pro 22H2 (19045), i9-12900KF, WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release,
BUILD_TESTING=ON. The results below are from an earlier head,862ce8bec0, merged locally ontomain3a0a54bbd8(clean merge), except the last two bullets, which are from the rebases onto0d6edf029eandb4a82720a8.guest_sysmoduleandguest_sysmodule-invalid-ids: both pass in 3 of 3 runs.guest_sysmoduletakes 2.09 s with its PS4 child.Does
guest_sysmodulefail without the change? Each case was rebuilt on the merge, with the stagedlibSceSysmodule.prxchecked to match the rebuilt one:kPs4ModuleIdsguest_sysmodulefailsisAcceptedModuleId)guest_sysmodulefailskPs4Acceptedonlyguest_sysmodulefailsguest_sysmodule-invalid-idspasses in each case. The unchanged merge passes before and after them.The tests
tools/select_tests.py selectpicks for the files the merge changes: 1,129 of 5,051, on the merge and onmain3a0a54bbd8. The same 66 fail on both sides, and no test differs:guest_kernel_sys_paths_symlinkat_patchedtimes out,public_headersfails because twolibSceXmlheaders onmain,Api.hppandInventoryExports.hpp, declare the same seven functions, and the 64public_headers_compile_*tests, which depend on it, are reported Not Run.agc_driver_partially_committed_volume_page_samplesskips on both sides.The title, inFAMOUS Second Son CUSA00223 01.07, on the same
main3a0a54bbd8. One build has7267fd467fmerged locally (without 0xd7): #18141's head at the time, and then this branch's commit before the last one; the other has an earlier head,862ce8bec0(with 0xd7). Each build got three traced starts (APS5_TRACE_CALLS) of up to 60 seconds. Both use the same converted files of the title, made earlier: the eboot with the relinker ofmained4b2e4cd8, itslibSceFios2.prxandlibc.prxwith that ofmainac243b6901, which has the samecore/relinkeras3a0a54bbd8. Both conversions have a local unwrap workaround (the stocktools/unwrap_self.pyfails on this eboot) and a local relinker change that also loadslibSceGnmDriverForNeoMode.prxfor the 47 imports of issue #17581. Neither is in this PR.7267fd467f)ud2in the title's ownlibSceFios2.prx, right after its call toscePthreadRwlockWrlockreturned0x80020016for a rwlock FIOS2 had destroyed. The trace counts 3scePthreadRwlockDestroycalls and 3sceSysmoduleLoadModulecalls.862ce8bec0)scePthreadRwlockDestroyis not among the trace's 32 most-called imports, whose smallest count is 1, so it was called at most once (3 times without 0xd7), andsceSysmoduleLoadModuleis called 4 times. The process ends after 4.4 to 4.7 s when FIOS2 callsfJgP+wqifno:libSceDiscMapUnknown_fJgP_plus_wqifno_nid_no_patch not implemented, alibSceDiscMapfunction AnyPS5 doesn't implement yet.python tools/check_conventions.py --base origin/main --title "<this title>" --body <this description>, with the tools ofmain3a0a54bbd8on862ce8bec0merged onto it: all conventions checks passed.tools/pr_overlap.py --branch(in a full clone): 2,026 open pull requests; four share a file with this branch. #18141, open then, was not listed: the tool skips pull requests whose head this branch contains.ddc3b0095a, which862ce8bec0replaced.Export.cpp, where both add an#include, and at the end ofmaininGuestSysmodule.cpp, where both add lines. On this branch's side both lines come from pushkarreddyy's commits. Keeping both sides' lines resolves them.main, so the tool could not compare them. By hand (git merge-tree): #5021'sExport.cppconflicts are withmain's WebAssembly lines, in the includes and infillModuleInfoForUnwind; they are the same withmainalone, and none of this branch's lines are in them. #14212 adds a blank line between the debt entries, one of them right after the entry for the 141 ids. pushkarreddyy's commits change that entry and add the PS4-process entry after it, so #14212 conflicts there with this branch; withmainalone the file merges cleanly. Keeping this branch's two entries, with blank lines around the PS4-process entry, resolves it.Rebased (2026-11-13) onto
main0d6edf029eas6e656acf6c, after #17904 merged; the rebase met the two conflicts the overlap check above names. Both sides' lines are kept, so the changed lines are the same as862ce8bec0's. pushkarreddyy's seven commits are kept; two of them,cb8ae9c8ccand47f6c981b6(nowa260cc0c0cand09b9bf5b62), each needed one of the two conflicts resolved, and no commit's own changed lines differ from before. On0d6edf029e:tools/select_tests.py selectpicks for the five changed files pass;guest_sysmoduleandguest_sysmodule-invalid-idspass in 3 of 3 runs;tools/check_conventions.pywith this title and description passes again on6e656acf6c;guest_sysmodulefails andguest_sysmodule-invalid-idspasses: each of the four ids left out ofkPs4ModuleIds, 0x80 added to it, the PS4 ids accepted in every process, no PS4 ids accepted, and each of the three calls limited to the public ids again. The unchanged branch passes before and after them.Rebased again (2026-11-13) onto
mainb4a82720a8as983c302fd1, after #19323 changedExport.cpp,GuestSysmodule.cppand the internal-ids debt entry right after ours, and GitHub reported a conflict. Git's own rebase went through without one but leftmain's two entries above ours and the internal-ids entry from before #19323 after them, so pushkarreddyy's docs commit (authorship kept) and this PR's last commit were rebuilt by hand on the newmain. Each of the eight commits changes the same lines as before, and the debt file now has the three entries: the 141 public ids, the PS4-process ids and #19323's internal ids. Onb4a82720a8:tools/select_tests.py selectpicks for the five changed files pass, none skipped;guest_sysmoduleandguest_sysmodule-invalid-idspass in 3 of 3 runs;tools/check_conventions.pywith this title and description passes on983c302fd1;guest_sysmodulefails andguest_sysmodule-invalid-idspasses. The unchanged branch passes before and after them.Not covered:
libSceDiscMapfunction inFAMOUS needs next, which is not part of this PR.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-10T19:14:32Z.
Review: DISMISSED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8b7645f203:tools/check_conventions.pypassed;git diff --checkclean.CMakeLists.txtfailed to build.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T17:56:16Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
5fcbad4785:tools/check_conventions.pypassed;git diff --checkclean.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T18:45:27Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ddc3b0095a:tools/check_conventions.pypassed;git diff --checkclean.windows.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-11T22:12:22Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The current branch independently overlaps open PR #18141, and combining the two heads produces conflicts in three shared files.
What I ran
Reviewed head
ddc3b0095a7d97aad3a169ab5fa6e13358991954. The no-build precheck usedmain402384f217d3c65c8af62cfa31aebbd53b697993.mainlater advanced to25952714bfa9b679d46391fc205471c0fc419655; the intervening changes are confined to libc files, and a fresh merge preview of this head with that current tip is clean. Environment: Linux 6.1, Debian glibc 2.36, Python 3.11.2, GCC 12.2.Results
mainis clean.guest_sysmoduleand its POSIX maps variant.guest_relative_sleepfailed.Commands and precheck results
The current-base merge preview was clean.
git merge-treereported content conflicts incore/libs/prx/libSceSysmodule/ModuleTable.hpp,core/libs/tests/GuestSysmodule.cpp, anddocs/dev/debt/libSceSysmodule.mdwhen combining the current heads of #18184 and #18141.Hosted Windows output for this head:
guest_sysmodule-invalid-idspassed;guest_sysmodulepassed; the suite ended with99% tests passed, 1 tests failed, identifying onlyguest_relative_sleep(Exit code 0xc0000409).Negative control
I did not run a negative control. The PR description reports that each tested regression to the ID acceptance rules makes
guest_sysmodulefail; I did not independently reproduce those variants.Findings
Blocking
0x97,0xa2, and0xb2through the same PS4-only path. #18184 independently carries those three IDs plus0xd7; merging the two current heads conflicts in the module table, test, and debt file. Please coordinate which PR owns the shared three-ID change. One option is to make #18184 depend on #18141 and reduce its change to the additional0xd7behavior; otherwise consolidate the four IDs into one PR and remove the duplicate implementation.Non-blocking
No separate non-blocking source issue identified in the inspected diff.
Sources
Not verified
guest_relative_sleep.To get this to a good state
Coordinate the shared implementation with #18141, update the dependency/checklist and push the resulting head. I will rerun the precheck, current-base overlap check, and relevant
guest_sysmoduletests on that exact head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-11T23:52:04Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
The new head declares and contains #18141 as its dependency, resolving the overlap from my previous review; the added
0xd7entry is kept in sync across implementation, test and debt documentation.What I ran
Reviewed head
862ce8bec06bb8d58ff87123bf006f8fbb78055a. The no-build precheck used base07531b0eb921626475e8b0d356d692df481b0d47; a later clean merge preview used currentmain85ab07d639e3bd4021e4fdff9f932663b8e709a2. Environment: Linux 6.1, glibc 2.36, Python 3.11.2, GCC 12.2.0.Results
mainis clean.0xd7implementation, exhaustive ID test list and debt entry agree.Commands and recorded output
Precheck summary, copied from its report:
The focused source delta from #18141 is exactly three insertions and three deletions:
0x00d7is added tokPs4ModuleIds, the test'skPs4Accepted, and the PS4-process debt entry. The merge preview returned tree43e363511578ebc9269a345e68c530af5604420fwith no conflict output.Hosted snapshot at the time of review: Windows, conventions and labels were pending; eligibility, report and library-portability passed; Linux, edge-watch, pipe-write, register-context, relinker, relinker-asan and write-watch were skipped.
Negative control
I did not independently rerun a negative control. The PR description reports that omitting
0xd7from the production list or test list makesguest_sysmodulefail; those results are author-reported, not tests I ran.Findings
Blocking
None found in the updated head's inspected changes.
Non-blocking
The required hosted checks were still pending, so this is not an approval.
Sources
kPs4ModuleIdsat the reviewed headNot verified
To get this to a good state
Let the pending hosted checks finish. I will recheck their results on this exact head before considering approval.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T22:33:38Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation scopes the four additional module IDs to PS4 processes, and the author reports passing tests on the exact head.
What I ran
Read the prepared diff and changed code at head
983c302fd1ecc55c9654f4fc603a064325577126throughrepo_read.py. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run independently. The title behavior, console behavior, and Linux/macOS behavior were not independently verified. Read all changed files listed in
manifest.json:core/libs/prx/libSceSysmodule/CMakeLists.txt,core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hpp,core/libs/tests/GuestSysmodule.cpp, anddocs/dev/debt/libSceSysmodule.md. No changed files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:23:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
983c302fd1:tools/check_conventions.pypassed;git diff --checkclean.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T20:23:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
983c302fd1:tools/check_conventions.pypassed;git diff --checkclean.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-28T07:34:32Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
697e7c803d:tools/check_conventions.pypassed.guest_sysmodule_testsbuilt cleanly.guest_sysmodule,guest_sysmodule_maps_scan):core/libs/prx/libSceSysmodule/Export.cpp,core/libs/prx/libSceSysmodule/ModuleTable.hppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T07:40:16Z.
Review: COMMENTED
Actionable comments posted: 2
1e334683-46a4-4852-9c86-ff562ac4a658Reviewing files that changed from the base of the PR and between
f3392ac198and697e7c803d.core/libs/prx/libSceSysmodule/Export.cppcore/libs/prx/libSceSysmodule/ModuleTable.hppcore/libs/tests/GuestSysmodule.cppdocs/dev/debt/libSceSysmodule.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T08:11:16Z.
Review: COMMENTED
Reviewed — comments
The change appears to scope the four listed module IDs to PS4 processes; I could not run the tests, and the Windows child-process command needs clarification.
What I ran
Reviewed head
697e7c803d22d547bc35af6c3d12edee4c824527using the prepared diff andrepo_read.py. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
core/libs/tests/GuestSysmodule.cpp:143constructs the Windows command with a leading quote beforecdand a trailing quote afterps4-child. This appears to quote the shell command itself rather than just the directory and executable, which may prevent the PS4 child test from launching under_wsystem. Please confirm this command works on Windows or adjust the quoting.Not verified
I did not run tests or independently verify the reported Windows results, console behavior, or Linux and macOS behavior. I read
Export.cpp,ModuleTable.hpp,GuestSysmodule.cpp, andlibSceSysmodule.md;files.jsonwas not available through the reader. The manifest lists all four changed files as included, and all four were inspected.To get this to a good state
Nothing is required. Optional: verify or correct the Windows command quoting noted above.