feat(libkernel_sys): implement sceKernelMlockall #10657
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10657"
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 joucknuck-br on 2026-10-24T15:28:29Z.
What
Implement
sceKernelMlockall(int flags)inlibkernel_sysby forwarding tolibkernel'smlockall_nid_postfixand mapping a non-zero POSIX result to0x80020000 | errno, returningSCE_KERNEL_ERROR_EINVALfor zero or unknown flags and throwing forMCL_CURRENTandMCL_FUTURE.Tested
Linux (WSL2 Ubuntu 24.04),
guest_kernel_sys_barrier_testsviactest --test-dir build -R guest_kernel_sys_barrier -V:sceKernelMlockall(0)returnsSCE_KERNEL_ERROR_EINVALsceKernelMlockall(0x4)andsceKernelMlockall(-4)returnSCE_KERNEL_ERROR_EINVALsceKernelMlockall(MCL_CURRENT),sceKernelMlockall(MCL_FUTURE), andsceKernelMlockall(MCL_CURRENT | MCL_FUTURE)throwstd::runtime_errorChecklist
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-24T15:29:59Z.
Review: CHANGES_REQUESTED
The changed export forwards the flag argument to the existing libkernel bridge, which is a useful step, and the focused tests cover invalid flags. However, the only valid flags (
MCL_CURRENT,MCL_FUTURE, and their combination) all throw inmlockall_nid_postfix; this PR therefore does not implement the advertised operation for any supported request. The repository rule says an export that cannot be implemented must throw and record the gap. Please either implement at least a meaningful supported behavior, or keep the export explicitly unsupported and describe this as a follow-up investigation rather than an implementation. If the throws remain intentional, update the debt entry to identify the still-unimplemented behavior and its limitation instead of describing only the forwarding. The PR also changes the discovered function signature from no arguments toint flags; please add the source/ABI evidence for that signature and a test that exercises the successful return path if one is supportable. The local test report is author-reported; hosted product jobs did not run. I did not run the focused test locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T15:45:11Z.
Review: APPROVED
Re-reviewed exact head
3e24f90def5d3b27ff06f72f32e70756cddd0daa. The change now clearly leaves valid memory-lock requests unsupported: invalid flags return mappedEINVAL, whileMCL_CURRENT/MCL_FUTUREcontinue to throw through the existing bridge, and the debt entry states this limitation. I verified theint flagssignature in Orbital’s type database and the flag validation/error mapping against the pinned fpPS4ps4_map_mm.pasreference. The focused Linux test results in the PR description are author-reported; this PR’s hosted product test jobs did not run, and I did not independently run them. The conventions and labels checks pass. I found no remaining blocking issue for this explicitly partial implementation.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T15:48:32Z.
Review: APPROVED
Reviewed — looks good
Nothing in the reviewed changes blocks merging; the forwarding implementation matches the existing libkernel behavior and the test covers invalid flags.
What I ran
Reviewed head
9aa0b5645eb2926c2c3b45fea1932b408aac2196. No commands or tests were run. Read the four changed files listed as reviewed inmanifest.json; no changed files were excluded.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports running
guest_kernel_sys_barrier_testsunder WSL2 Ubuntu 24.04; this review did not independently run that test. Console behavior is not measured, as noted in the debt entry.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:17:21Z.
Review: COMMENTED
Please reconcile this wrapper with the
mlockall_nid_postfiximplementation on currentmain. The implementation at the PR head validates the flags, but the merge result againstde4730493acalls the newer helper that returnsGuestNotPermittedfor every value. The wrapper therefore mapssceKernelMlockall(0)toEPERMeven though the added assertion expectsEINVAL. The supported-flag path also returnsEPERM, while the PR description says it throws.I reproduced a
guest_kernel_sys_barrierabort after integrating9aa0b5645einto a Linux release build. I then checked the helper in the merge result against currentmainand confirmed the error-mapping discrepancy in source.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.