fix(libkernel): refuse undefined protection bits in sceKernelBatchMap's map operations, as a PS5 does #22040
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22040"
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:05:49Z.
What
A batch map entry whose protection had an undefined bit (0x08) threw from the host protection conversion. The console refuses undefined protection bits in the map calls with
EINVALbefore mapping, as the five single flexible and direct map calls here already do (thesceKernelMprotect protection bitsentry indocs/dev/debt/libkernel.md, which listed the batch map calls as throwing).EINVALat that entry, reporting the entries processed before it. Only the single map calls were measured; the batch calls are taken to refuse them the same way.GuestKernelBatchMapGuestPointers.cpp: a flexible entry with 0x0b after a good one stops withEINVALand 1 processed; a direct entry with 0x08 stops withEINVALand 0 processed.sceKernelMtypeprotect); whichever lands second merges the wording.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
mainec7369ecb8.ctest -R '^guest_kernel_batch_map_guest_pointers$': passed.main'sExport.cppand this branch's test,guest_kernel_batch_map_guest_pointersaborts withUnsupported memory protection bits: 11.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.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:14:21Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b0f39f3a37: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-23T01:46:26Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review evidence supports merging.
What I ran
Reviewed head
b0f39f3a37381c4eea052cb912f6dd9e502002b9using the prepared diff and pinned reader. No commands or tests were run by me; the PR description reports Linux tests and convention checks.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run independently. Windows and macOS behavior, console behavior, and the author-reported tests were not independently verified. Read:
core/libs/prx/libkernel/DirectMemory/Export.cpp,core/libs/tests/GuestKernelBatchMapGuestPointers.cpp, anddocs/dev/debt/changes/fix-libkernel-batch-map-undefined-protection.md. The prepared bundle lists all three changed files as included; no changed files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:08:16Z.
Review: APPROVED
I read the diff at
b0f39f3a37. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build).guest_kernel_batch_map_guest_pointers: pass on both.main's, the same test fails too.Not checked: a console.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:12:48Z.
Review: COMMENTED
I compiled and ran
GuestKernelBatchMapGuestPointersfrom this branch on Linux against the existing runtime libraries. It passed the direct-map rejection and partial-progress checks. #22051 changes the same mapping path and also covers the protect operation, so please coordinate the merge order for the shared change.AI-assisted: yes.