fix(libkernel): drop undefined protection bits in sceKernelBatchMap's protect operation, as sceKernelMprotect does #22051
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22051"
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 brajankw on 2026-11-17T03:06:46Z.
What
Builds on #22040, which this branch contains; review its last commit. A batch map protect entry with a protection bit outside 0x3F7 threw from the host protection conversion.
sceKernelMprotectdrops those bits, as a PS5 (firmware 13.60) does (thesceKernelMprotect protection bitsentry indocs/dev/debt/libkernel.md), and the batch protect operation is the same change of protection, so it drops them too. The map operations refuse them (#22040) and the type-protect operation still throws.GuestKernelBatchMapGuestPointers.cpp: protecting a mapped page with 0x09 through the batch call succeeds and leaves protection 1.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
mainec7369ecb8.ctest -R '^guest_kernel_batch_map_guest_pointers$': passed.Export.cppand this branch's test,guest_kernel_batch_map_guest_pointersaborts withUnsupported memory protection bits: 9.ctest(5896 tests,-j 12) with this branch and my other twelve branches of this round merged ontomain521fb7fec4: 5880 passed. The 16 failures are the set that fails onmainin the same environment: sixagc_drivercases (agc_driver_image_table_packed_guardspasses when run on its own) and ten that need a.gitdirectory, network or a passwd entry for the user.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch: failed closed on #16945, #17718, #17936 and #21569, which conflict withmain; none of their diffs touchessceKernelBatchMap2. Otherwise no overlap besides #22040, which it builds on.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 PrivacyOnion on 2026-11-17T03:10:44Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
393aaeab12:tools/check_conventions.pypassed.guest_kernel_batch_map_guest_pointersbuilt cleanly.guest_kernel_batch_map_guest_pointers):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-21T13:33:21Z.
Review: COMMENTED
Reviewed — comments
The mapped code applies the existing protection-bit mask consistently to batch protect operations; the host test results and console behavior were not independently verified.
What I ran
Read the prepared diff and all three changed files at head
393aaeab12eed1d23e822e98fd1c091869bbf22e, plus the protection-mask helper and the existingsceKernelMprotectimplementation inExport.cpp. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
0x09viasceKernelBatchMap, while the change is insceKernelBatchMap2's protect operation.sceKernelBatchMapdelegates tosceKernelBatchMap2, so the path is covered, but a directsceKernelBatchMap2protect case would make the test more explicit (core/libs/tests/GuestKernelBatchMapGuestPointers.cpp:141).Not verified
core/libs/prx/libkernel/DirectMemory/Export.cpp,core/libs/tests/GuestKernelBatchMapGuestPointers.cpp,docs/dev/debt/changes/fix-libkernel-batch-map-undefined-protection.md. No changed files were excluded; all three were marked included in the manifest.To get this to a good state
Nothing is required. The direct
sceKernelBatchMap2test case is optional.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:12:46Z.
Review: COMMENTED
I compiled and ran
GuestKernelBatchMapGuestPointersfrom this branch on Linux against the existing runtime libraries. It passed the partial-progress checks for rejected map protections and the virtual-query check for protections applied by the protect operation. This overlaps the map-protection change in #22040. Please coordinate the merge order for the shared change.AI-assisted: yes.