fix(libkernel): bound virtual range names as the console does #21569
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21569"
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 kali113 on 2026-11-16T12:23:21Z.
What
sceKernelSetVirtualRangeNameandsceKernelClearVirtualRangeNamerefuse withEINVALa range whose start is below 0x4000 or at or above 2^47, or whose end is above 2^47. A length of 0 returns 0 only for a valid start. The range does not need to be mapped. The named-mapping calls (sceKernelMapNamed*) keep their existing checks.Measured on a PS5 payload process, firmware 13.590.001 (a payload, not a title process):
EINVAL; 0x4000 and 0xffff return 0; 0x1000 returnsEINVAL; 0x7ffffffff000 with 0x4000 bytes and 0xffff800000000000 returnEINVAL.EINVAL.EINVAL.Overlap: #21565 changes the same function (the name copy). Both touch the same three lines of
sceKernelSetVirtualRangeName, so whichever merges second needs a rebase. #16945 and #17718 (named-mapping name checks) share the test file'smain()list, with no shared exports.Tested
guest_memory_tests(the whole binary) exits 0 with this change.Export.cppaborts (exit 134) in the new check.tools/check_conventions.py --base origin/mainpasses.Raw console lines, payload process, firmware 13.590.001 (set/clr lines of results/console_libkernel_range_2026-11-15.log and _range2_)
Checklist
main; no other open PR implements the same functions (#21565 changes the same function's name copy, see What)NotImplemented_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 copilot-pull-request-reviewer[bot] on 2026-11-16T12:23:49Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T12:25:02Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
eda38af41c:tools/check_conventions.pypassed;git diff --checkclean.guest_memory_testsbuilt cleanly.guest_memory,guest_mmap_fixed_anonymous,guest_mmap_executable):core/libs/prx/libkernel/DirectMemory/Export.cppreverted 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 MarcZX10 on 2026-11-17T02:45:35Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
eda38af41c0c0e98051a46ed9205771e93b1585e, basemain.diff.patch, then read head ranges with the reader:Results
Export.cpp80–140core/guest_memory_teststools/check_conventions.pyMeasured values checked against the code
0x3000and0x1000start:EINVAL. Code: start below0x4000.0x7ffffffff000with0x4000:EINVAL. Code:lenabove2^47 - start.0x4000,0xffff,0x20000with length 0:0. Code: start valid, length 0 returns after the bounds check.2^47passes; one byte further fails. Code:len <= 2^47 - start.Findings
Blocking: none.
Non-blocking: none.
Sources
github.com/boykopovar/AnyPS5@eda38af41c/core/libs/prx/libkernel/DirectMemory/Export.cpp (L120-L126)github.com/boykopovar/AnyPS5@eda38af41c/core/libs/prx/libkernel/DirectMemory/Export.cpp (L632-L642)Not verified
eda38af. The status check was refused in this run, so I cannot say whether the required checks passed. This is the reason the event isCOMMENTand notAPPROVE.guest_memory_testsrun (exit 0), and the negative control (main'sExport.cppaborts with exit 134). All are author-reported. I did not run them.tools/check_conventions.py --base origin/main: author-reported, not run.results/console_libkernel_range_*.log) are not in the review folder. I checked the raw lines in the description against the code, not against the log files.ENAMETOOLONGnote in the debt file. No change here touches the name length, but I did not re-measure it.docs/dev/debt/changes/. My search for the## changeheading found no matches, so I did not compare it.Export.cpp(1023 lines) orGuestMemory.cpp(4986 lines) in full. I read their diff hunks,Export.cpplines 80–140, and the search results for the callers.To get this to a good state
Nothing is required.
Optional:
eda38afare green before merge.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:23:19Z.
Review: COMMENTED
This head conflicts with current main in
DirectMemory/Export.cpp. Please keep main'sCopyRangeNamepath and add the range bounds around it. The PR's older branch still reads the name throughstrnlen; taking that hunk as written would discard main's checked copy.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.