fix(libkernel): write the module handles before failing a null count as measured on a PS5 #11224
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11224"
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 orezraey on 2026-10-25T22:08:54Z.
What
sceKernelGetModuleListand its variants (List2,ListInternal, which shareFillModuleList) now write the handles before they fail a nullactualpointer withEFAULT, as a retail PS5 (firmware 13.60) does. Before, they returnedEFAULTwithout writing anything. Measured with a homebrew probe from a payload process; the source and console log are in this gist (pmodlist).On the console, for both
sceKernelGetModuleListandsceKernelGetModuleList2:actual1 and one handle, 0 ("eboot.bin").ENOMEM, writing neitheractualnor any handle.actual. ReturnsEFAULTafter writing handle 0 into the buffer. This is the change.EFAULTwithactualuntouched.sceKernelGetModuleInfo2.EPERMfor libkernel's handle,EINVALfor a size of 0,EFAULTfor a null info andESRCHfor a bad handle, as here.The debt entry asked whether the console writes any handles when it fails, and now records that. It also starts with what still differs. On the console the payload's lists contain only its main program, as handle 0, though libkernel (handle 1) and libSceLibcInternal (handle 2) are loaded. AnyPS5 lists every loaded
.prx, with its own ids. A payload is not a title, so that part is recorded rather than changed.Before and after
sceKernelGetModuleList/List2actualEFAULT, handles writtenEFAULT, nothing writtenEFAULT, handles writtenactualand handles writtenENOMEM, nothing writtenEFAULT,actualuntouched.prx.prx(debt)Tested
Windows 11, WinLibs GCC 15.2, full build. The 26 tests matching
modulepass 3 times out of 3.guest_module_infoandguest_kernel_sys_module_internalnow check that a nullactualreturnsEFAULTand still fills the buffer with the same handles a successful call returns.tools/check_conventions.pypasses.Head
19f56c530aonmainf2c8e1dda4.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:15:18Z.
Review: APPROVED
Reviewed exact head
19f56c530a02e073ae055f0aa4973d4864f39666, the linked firmware 13.60 probe source/log,FillModuleListcallers, and the added tests. The order now matches the measured cases: reject a null handle array first, write up tocounthandles, returnENOMEMwithout touchingactualwhen the list does not fit, then returnEFAULTfor nullactualafter a full list has been written. The probe records those behaviors for both list exports, and the tests assert that a nullactualleaves the same handle array as a successful call.Current-main
git diff --checkand conventions pass; the debt-length warning is non-failing. The merge preview against current main is clean. Hosted eligibility, conventions, intake, labels and report pass; product build jobs are skipped by path policy. The 26 focused module tests (three runs) and Windows full build are author-reported againstmainf2c8e1dda4; I did not rerun them locally. No defect found in the reviewed change.