fix(kernel): sceKernelMtypeprotect refuses memory types 10, 127 and -1 and undefined protection bits #19183

Merged
xXPBSXx merged 4 commits from upstream-pr/19183 into main 2026-11-21 16:49:38 +00:00
xXPBSXx commented 2026-11-12 22:58:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-12T22:58:00Z.


What

sceKernelMtypeprotect accepted every memory type and threw for a protection with bits outside 0x3F7. On a PS5 (firmware 11.60, payload process) the types 0 to 9, 11, 15 and 16 are set (run 1, lines 5 to 14 and 16 to 18 of the raw output), type 10 returns EACCES (0x8002000d, line 15), and the types 127 and -1 return EINVAL (0x80020016, lines 19 and 20); after a refusal the memory type the mapping had is unchanged (the probe read it back each time). A protection of 0x400 returns EINVAL (run 1, line 21), and so do 0x8, 0x800, 0x3ff, 0xffffff00, 0xffffff7f, 0xffffff80, 0xfffffff2 and 0xffffffff (run 2, lines 6 to 13); 0x80000000 returns 0 (run 1, line 22; run 2, line 14). This returns EACCES for the type 10 and EINVAL for a type below 0 or of 127, and EINVAL for a protection with undefined bits instead of throwing, in each case before the mapping or its type is changed. A protection of 0x80000000 still throws here, because the console accepted it and what it does to the protection bits was not measured. The two entries for sceKernelMtypeprotect and for the protection bits in docs/dev/debt/libkernel.md state the measurements.

Not measured, and unchanged: the types 12 to 14 and 17 to 126 (accepted here), the order in which the console checks the type and the protection, and sceKernelBatchMap2 operation 4 and the memory pool batch, which use the same path without these refusals. 2 of the 53 titles checked import sceKernelMtypeprotect, with 11 call sites: PPSA20612 passes the type 12 at all 10 of its sites, and PPSA01325 maps its input 0 to 12 and 3 or 10 to 11 and passes any other value through; the protections passed are 0xf2, 0x32 and 0x2, and none is 0x400, 0x80000000 or another bit outside 0x3F7. The type 12 of the title cases was not measured, so no title is shown to pass a changed case; this is a read of the call sites, not a run. A title process was not measured.

Tested

Measured on a PS5 with firmware 11.60 (kernel_get_fw_version 0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr), in two runs on 2026-11-12 at 17:25 UTC (run 1) and 19:25 UTC (run 2). A title process may differ. The first comment has the probe source and raw output of each run; the line numbers are those of the run named.

Call (on an own 2 MiB direct mapping) PS5, payload process, firmware 11.60 AnyPS5 main before here
memory type 0 to 9, 11, 15, 16 0, type set (run 1, lines 5 to 14, 16 to 18) accepted 0, unchanged
memory type 10 EACCES, type unchanged (run 1, line 15) accepted EACCES, type unchanged
memory type 127, -1 EINVAL, type unchanged (run 1, lines 19, 20) accepted EINVAL, type unchanged
protection 0x400 EINVAL (run 1, line 21) throws EINVAL
protection 0x8, 0x800, 0x3ff, 0xffffff00, 0xffffff7f, 0xffffff80, 0xfffffff2, 0xffffffff EINVAL (run 2, lines 6 to 13) throws EINVAL
protection 0x80000000 0 (run 1, line 22; run 2, line 14) throws throws, unchanged
memory types 12 to 14 and 17 to 126 not measured accepted accepted, unchanged

The test commit pins type 10, 127 and -1, the protection 0x400 and the eight values of run 2 other than 0x80000000 (as -256, -129, -128, -14, -1, 8, 0x800 and 0x3ff), that the memory type and protection of the mapping are unchanged after a refusal, and that the types 0, 1, 9, 11, 15 and 16 are accepted. On main 09ab49de964, Linux (WSL, Release), which contains the base of this branch and does not differ from it in the files this change touches, built for the target guest_memory with ninja returning 0 for each commit: with only the test commit guest_memory aborts in 1 run, and with the fix and with the documentation commit it passes in 3 of 3 runs each. The documentation commit was changed afterwards in one sentence of the entry for the protection bits (no code or test), and the tests were not run again for that version. tools/check_conventions.py passes with no error on each of the three commits, with one debt-length warning on the last: the entry for the protection bits is 1299 characters, up from 994 (the entry for sceKernelMtypeprotect is 734, up from 503). The probe sources and raw outputs are in the first comment. Not tested: Windows, macOS, the CI runner, a title process, any other firmware, and the cases listed above as not measured.

Overlap: the 99 other open pull requests that change DirectMemory/Export.cpp, GuestMemory.cpp or docs/dev/debt/libkernel.md (found by reading the changed files of all 1649 open pull requests at about 21:30 UTC) were merged on 2026-11-12 at about 21:40 UTC against main 59f3a64cf6 (the branch is based on 6907cfb864); the branch merges into it without a conflict. 60 of them already conflict with main without this change and still conflict with it; 38 merge cleanly with and without it. #17794 (keep direct-memory aliases consistent across retype, release and remap, which also changes sceKernelMtypeprotect in DirectMemory.cpp and its entry in docs/dev/debt/libkernel.md) conflicts only with this change, in GuestMemory.cpp and the debt file; its added test calls sceKernelMtypeprotect with the type 5 and the protection 3, which this change still accepts, so the two do not contradict each other; whichever of the two merges second needs a small rebase.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (no graphics change)
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5286630384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19183). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-11-12T22:58:00Z. --- ### What `sceKernelMtypeprotect` accepted every memory type and threw for a protection with bits outside `0x3F7`. On a PS5 (firmware 11.60, payload process) the types 0 to 9, 11, 15 and 16 are set (run 1, lines 5 to 14 and 16 to 18 of the raw output), type 10 returns `EACCES` (0x8002000d, line 15), and the types 127 and -1 return `EINVAL` (0x80020016, lines 19 and 20); after a refusal the memory type the mapping had is unchanged (the probe read it back each time). A protection of 0x400 returns `EINVAL` (run 1, line 21), and so do 0x8, 0x800, 0x3ff, 0xffffff00, 0xffffff7f, 0xffffff80, 0xfffffff2 and 0xffffffff (run 2, lines 6 to 13); 0x80000000 returns 0 (run 1, line 22; run 2, line 14). This returns `EACCES` for the type 10 and `EINVAL` for a type below 0 or of 127, and `EINVAL` for a protection with undefined bits instead of throwing, in each case before the mapping or its type is changed. A protection of 0x80000000 still throws here, because the console accepted it and what it does to the protection bits was not measured. The two entries for `sceKernelMtypeprotect` and for the protection bits in `docs/dev/debt/libkernel.md` state the measurements. Not measured, and unchanged: the types 12 to 14 and 17 to 126 (accepted here), the order in which the console checks the type and the protection, and `sceKernelBatchMap2` operation 4 and the memory pool batch, which use the same path without these refusals. 2 of the 53 titles checked import `sceKernelMtypeprotect`, with 11 call sites: PPSA20612 passes the type 12 at all 10 of its sites, and PPSA01325 maps its input 0 to 12 and 3 or 10 to 11 and passes any other value through; the protections passed are 0xf2, 0x32 and 0x2, and none is 0x400, 0x80000000 or another bit outside `0x3F7`. The type 12 of the title cases was not measured, so no title is shown to pass a changed case; this is a read of the call sites, not a run. A title process was not measured. ### Tested Measured on a PS5 with firmware 11.60 (`kernel_get_fw_version` 0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr), in two runs on 2026-11-12 at 17:25 UTC (run 1) and 19:25 UTC (run 2). A title process may differ. The first comment has the probe source and raw output of each run; the line numbers are those of the run named. | Call (on an own 2 MiB direct mapping) | PS5, payload process, firmware 11.60 | AnyPS5 `main` before | here | |---|---|---|---| | memory type 0 to 9, 11, 15, 16 | 0, type set (run 1, lines 5 to 14, 16 to 18) | accepted | 0, unchanged | | memory type 10 | `EACCES`, type unchanged (run 1, line 15) | accepted | `EACCES`, type unchanged | | memory type 127, -1 | `EINVAL`, type unchanged (run 1, lines 19, 20) | accepted | `EINVAL`, type unchanged | | protection 0x400 | `EINVAL` (run 1, line 21) | throws | `EINVAL` | | protection 0x8, 0x800, 0x3ff, 0xffffff00, 0xffffff7f, 0xffffff80, 0xfffffff2, 0xffffffff | `EINVAL` (run 2, lines 6 to 13) | throws | `EINVAL` | | protection 0x80000000 | 0 (run 1, line 22; run 2, line 14) | throws | throws, unchanged | | memory types 12 to 14 and 17 to 126 | not measured | accepted | accepted, unchanged | The test commit pins type 10, 127 and -1, the protection 0x400 and the eight values of run 2 other than 0x80000000 (as -256, -129, -128, -14, -1, 8, 0x800 and 0x3ff), that the memory type and protection of the mapping are unchanged after a refusal, and that the types 0, 1, 9, 11, 15 and 16 are accepted. On `main` `09ab49de964`, Linux (WSL, Release), which contains the base of this branch and does not differ from it in the files this change touches, built for the target `guest_memory` with `ninja` returning 0 for each commit: with only the test commit `guest_memory` aborts in 1 run, and with the fix and with the documentation commit it passes in 3 of 3 runs each. The documentation commit was changed afterwards in one sentence of the entry for the protection bits (no code or test), and the tests were not run again for that version. `tools/check_conventions.py` passes with no error on each of the three commits, with one `debt-length` warning on the last: the entry for the protection bits is 1299 characters, up from 994 (the entry for `sceKernelMtypeprotect` is 734, up from 503). The probe sources and raw outputs are in the first comment. Not tested: Windows, macOS, the CI runner, a title process, any other firmware, and the cases listed above as not measured. Overlap: the 99 other open pull requests that change `DirectMemory/Export.cpp`, `GuestMemory.cpp` or `docs/dev/debt/libkernel.md` (found by reading the changed files of all 1649 open pull requests at about 21:30 UTC) were merged on 2026-11-12 at about 21:40 UTC against `main` `59f3a64cf6` (the branch is based on `6907cfb864`); the branch merges into it without a conflict. 60 of them already conflict with `main` without this change and still conflict with it; 38 merge cleanly with and without it. #17794 (keep direct-memory aliases consistent across retype, release and remap, which also changes `sceKernelMtypeprotect` in `DirectMemory.cpp` and its entry in `docs/dev/debt/libkernel.md`) conflicts only with this change, in `GuestMemory.cpp` and the debt file; its added test calls `sceKernelMtypeprotect` with the type 5 and the protection 3, which this change still accepts, so the two do not contradict each other; whichever of the two merges second needs a small rebase. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a (no graphics change) <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-13 01:05:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T01:05:18Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head: b0f761b3ae83604c9528d35605ec7e8518089ed7, base main.
  • No build, no test run and no merge preview. I read the diff and the code at the head with the reader.
  • Reader calls:
python3 repo_read.py search UndefinedProtection
python3 repo_read.py search SCE_KERNEL_ERROR_EACCES
python3 repo_read.py cat core/libs/prx/libkernel/DirectMemory/Export.cpp 60 70
python3 repo_read.py cat core/libs/prx/libkernel/DirectMemory/Export.cpp 520 560
python3 repo_read.py cat core/libs/tests/GuestMemory.cpp 330 362
python3 repo_read.py cat core/libs/tests/GuestMemory.cpp 1150 1185

Results

Check Result Note
Diff matches head passed Three files, from the head
Code matches the description passed Refusals in sceKernelMtypeprotect as stated
Test expectations match the code passed Types 10, 127, -1 and protection 0x400 pinned
Build and tests not run Author reports a WSL Release build
Convention check not run Author reports one debt-length warning
Merge preview on main not run Author reports a clean merge

Findings

Blocking

None.

Non-blocking

  • Types above 127 are accepted by the code, and neither the description nor the debt entry says what the console does with them. core/libs/prx/libkernel/DirectMemory/Export.cpp:538 refuses only negative types and 127, and docs/dev/debt/libkernel.md:117 lists only 12 to 14 and 17 to 126 as not measured. Add 128 and above to that list, or measure them.

Not verified

  • Build and test results, the convention check and the merge preview: author-reported, not run here.
  • Console results for firmware 11.60 and the run IDs in the debt entries: author-measured, not checked here.
  • Title-process call sites (PPSA20612, PPSA01325, the 53 titles checked): not checked here.
  • Overlap with the 99 open pull requests and #17794: not checked here.
  • Files: all three changed files were reviewed through diff.patch. Head context was read only for Export.cpp lines 60 to 70 and 520 to 560, and GuestMemory.cpp lines 330 to 362 and 1150 to 1185. docs/dev/debt/libkernel.md was read only in its two hunks, not at the head. No file was read in full. No file was excluded.

To get this to a good state

Nothing is required.

Optional: state what the console does with types 128 and above in docs/dev/debt/libkernel.md, next to the 17 to 126 entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5884526849 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19183#pullrequestreview-5884526849). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-13T01:05:18Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head: `b0f761b3ae83604c9528d35605ec7e8518089ed7`, base `main`. - No build, no test run and no merge preview. I read the diff and the code at the head with the reader. - Reader calls: ``` python3 repo_read.py search UndefinedProtection python3 repo_read.py search SCE_KERNEL_ERROR_EACCES python3 repo_read.py cat core/libs/prx/libkernel/DirectMemory/Export.cpp 60 70 python3 repo_read.py cat core/libs/prx/libkernel/DirectMemory/Export.cpp 520 560 python3 repo_read.py cat core/libs/tests/GuestMemory.cpp 330 362 python3 repo_read.py cat core/libs/tests/GuestMemory.cpp 1150 1185 ``` ## Results | Check | Result | Note | |---|---|---| | Diff matches head | passed | Three files, from the head | | Code matches the description | passed | Refusals in `sceKernelMtypeprotect` as stated | | Test expectations match the code | passed | Types 10, 127, -1 and protection 0x400 pinned | | Build and tests | not run | Author reports a WSL Release build | | Convention check | not run | Author reports one `debt-length` warning | | Merge preview on `main` | not run | Author reports a clean merge | ## Findings **Blocking** None. **Non-blocking** - Types above 127 are accepted by the code, and neither the description nor the debt entry says what the console does with them. `core/libs/prx/libkernel/DirectMemory/Export.cpp:538` refuses only negative types and 127, and `docs/dev/debt/libkernel.md:117` lists only 12 to 14 and 17 to 126 as not measured. Add 128 and above to that list, or measure them. ## Not verified - Build and test results, the convention check and the merge preview: author-reported, not run here. - Console results for firmware 11.60 and the run IDs in the debt entries: author-measured, not checked here. - Title-process call sites (PPSA20612, PPSA01325, the 53 titles checked): not checked here. - Overlap with the 99 open pull requests and #17794: not checked here. - Files: all three changed files were reviewed through `diff.patch`. Head context was read only for `Export.cpp` lines 60 to 70 and 520 to 560, and `GuestMemory.cpp` lines 330 to 362 and 1150 to 1185. `docs/dev/debt/libkernel.md` was read only in its two hunks, not at the head. No file was read in full. No file was excluded. ## To get this to a good state Nothing is required. Optional: state what the console does with types 128 and above in `docs/dev/debt/libkernel.md`, next to the 17 to 126 entry.
PrivacyOnion commented 2026-11-13 03:18:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T03:18:42Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against b0f761b3ae:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_memory_tests built cleanly.
  • CTest (guest_memory_pool_stats, guest_memory_resource, guest_memory_lifetime, guest_memory, guest_mmap_fixed_anonymous, guest_mmap_executable):
    1/6 Test  #865: guest_memory_pool_stats ..........   Passed    0.03 sec
    2/6 Test  #962: guest_memory_resource ............   Passed    0.03 sec
    3/6 Test #4434: guest_memory_lifetime ............   Passed    0.05 sec
    4/6 Test #4685: guest_mmap_executable ............   Passed    0.03 sec
    5/6 Test #4684: guest_mmap_fixed_anonymous .......   Passed    0.03 sec
    6/6 Test #4683: guest_memory .....................   Passed    2.67 sec
    100% tests passed, 0 tests failed out of 6
    
  • Negative control: with core/libs/prx/libkernel/DirectMemory/Export.cpp reverted to main and the new tests kept, the suite fails:
    1/6 Test #4434: guest_memory_lifetime ............   Passed    0.03 sec
    2/6 Test  #962: guest_memory_resource ............   Passed    0.02 sec
    3/6 Test #4685: guest_mmap_executable ............   Passed    0.04 sec
    4/6 Test  #865: guest_memory_pool_stats ..........   Passed    0.03 sec
    5/6 Test #4684: guest_mmap_fixed_anonymous .......   Passed    0.03 sec
    6/6 Test #4683: guest_memory .....................Subprocess aborted***Exception:   0.48 sec
    83% tests passed, 1 tests failed out of 6
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/libs/prx/libkernel/DirectMemory/Export.cpp:537: Verified that sceKernelMtypeprotect returns SCE_KERNEL_ERROR_EACCES (0x8002000D) when type == 10, matching PS5 hardware probe measurements.
    • core/libs/prx/libkernel/DirectMemory/Export.cpp:538: Verified that sceKernelMtypeprotect returns SCE_KERNEL_ERROR_EINVAL (0x80020016) for negative types (type < 0) and type 127 without mutating memory state.
    • core/libs/prx/libkernel/DirectMemory/Export.cpp:539: Verified that UndefinedProtection(prot) properly identifies bits outside 0x3F7, returns SCE_KERNEL_ERROR_EINVAL for undefined protections, and exempts std::numeric_limits::min() (0x80000000) so it throws in DoMtypeprotect as documented in docs/dev/debt/libkernel.md.
    • core/libs/prx/libkernel/DirectMemory/Export.cpp:536-540: Verified validation ordering and confirmed that all parameter rejections execute before DoMtypeprotect is reached, guaranteeing no mapping or direct memory state is partially altered on failure.
    • core/libs/tests/GuestMemory.cpp:358,1169-1174: Verified that unit tests in CheckStrictMemoryProtectionBits and CheckMtypeprotect exercise all refusal branches (10, 127, -1, 0x400, negative protections), confirm accepted types {0, 1, 9, 11, 15, 16}, and verify via sceKernelVirtualQuery that protection and memory_type remain unchanged after refusals.
    • core/libs/prx/libkernel/DirectMemory/Export.cpp, GuestMemory.cpp, docs/dev/debt/libkernel.md: Verified strict AGENTS.md compliance, confirming zero forbidden code comments were introduced, no unauthorized files were added, and technical debt documentation was properly updated.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5885499783 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19183#pullrequestreview-5885499783). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-13T03:18:42Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `b0f761b3ae`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_memory_tests` built cleanly. - **CTest** (`guest_memory_pool_stats`, `guest_memory_resource`, `guest_memory_lifetime`, `guest_memory`, `guest_mmap_fixed_anonymous`, `guest_mmap_executable`): ``` 1/6 Test #865: guest_memory_pool_stats .......... Passed 0.03 sec 2/6 Test #962: guest_memory_resource ............ Passed 0.03 sec 3/6 Test #4434: guest_memory_lifetime ............ Passed 0.05 sec 4/6 Test #4685: guest_mmap_executable ............ Passed 0.03 sec 5/6 Test #4684: guest_mmap_fixed_anonymous ....... Passed 0.03 sec 6/6 Test #4683: guest_memory ..................... Passed 2.67 sec 100% tests passed, 0 tests failed out of 6 ``` - **Negative control**: with `core/libs/prx/libkernel/DirectMemory/Export.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/6 Test #4434: guest_memory_lifetime ............ Passed 0.03 sec 2/6 Test #962: guest_memory_resource ............ Passed 0.02 sec 3/6 Test #4685: guest_mmap_executable ............ Passed 0.04 sec 4/6 Test #865: guest_memory_pool_stats .......... Passed 0.03 sec 5/6 Test #4684: guest_mmap_fixed_anonymous ....... Passed 0.03 sec 6/6 Test #4683: guest_memory .....................Subprocess aborted***Exception: 0.48 sec 83% tests passed, 1 tests failed out of 6 ``` Restoring the change makes it pass again. - **Code reading**: - core/libs/prx/libkernel/DirectMemory/Export.cpp:537: Verified that sceKernelMtypeprotect returns SCE_KERNEL_ERROR_EACCES (0x8002000D) when type == 10, matching PS5 hardware probe measurements. - core/libs/prx/libkernel/DirectMemory/Export.cpp:538: Verified that sceKernelMtypeprotect returns SCE_KERNEL_ERROR_EINVAL (0x80020016) for negative types (type < 0) and type 127 without mutating memory state. - core/libs/prx/libkernel/DirectMemory/Export.cpp:539: Verified that UndefinedProtection(prot) properly identifies bits outside 0x3F7, returns SCE_KERNEL_ERROR_EINVAL for undefined protections, and exempts std::numeric_limits<int>::min() (0x80000000) so it throws in DoMtypeprotect as documented in docs/dev/debt/libkernel.md. - core/libs/prx/libkernel/DirectMemory/Export.cpp:536-540: Verified validation ordering and confirmed that all parameter rejections execute before DoMtypeprotect is reached, guaranteeing no mapping or direct memory state is partially altered on failure. - core/libs/tests/GuestMemory.cpp:358,1169-1174: Verified that unit tests in CheckStrictMemoryProtectionBits and CheckMtypeprotect exercise all refusal branches (10, 127, -1, 0x400, negative protections), confirm accepted types {0, 1, 9, 11, 15, 16}, and verify via sceKernelVirtualQuery that protection and memory_type remain unchanged after refusals. - core/libs/prx/libkernel/DirectMemory/Export.cpp, GuestMemory.cpp, docs/dev/debt/libkernel.md: Verified strict AGENTS.md compliance, confirming zero forbidden code comments were introduced, no unauthorized files were added, and technical debt documentation was properly updated. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
MarcZX10 commented 2026-11-21 04:26:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:26:14Z.

Review: APPROVED


Reviewed — looks good

The change adds the measured sceKernelMtypeprotect refusals, matching tests and debt documentation; I found no verified blocking defect in the three changed files.

What I ran

Reviewed head 6aa3592c3ae6838523c90fb7c779a7ea075cd7e7. Read the prepared description, commit list, manifest, diff, and full head text for all three changed files through repo_read.py. I did not run commands or tests.

Results

Check Result Note
Changed-file review passed All three changed files read
Automated checks not run No commands or tests run

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported PS5 measurements and reported Linux test runs were supplied in the description and were not independently reproduced. Windows, macOS, CI, title-process behavior, and unmeasured memory types and call paths were not verified. The changed files reviewed were core/libs/prx/libkernel/DirectMemory/Export.cpp, core/libs/tests/GuestMemory.cpp, and docs/dev/debt/libkernel.md; files.json was not available through the reader, so excluded-file details were not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002811198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19183#pullrequestreview-6002811198). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T04:26:14Z. **Review:** APPROVED --- # Reviewed — looks good The change adds the measured `sceKernelMtypeprotect` refusals, matching tests and debt documentation; I found no verified blocking defect in the three changed files. ## What I ran Reviewed head `6aa3592c3ae6838523c90fb7c779a7ea075cd7e7`. Read the prepared description, commit list, manifest, diff, and full head text for all three changed files through `repo_read.py`. I did not run commands or tests. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | All three changed files read | | Automated checks | not run | No commands or tests run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported PS5 measurements and reported Linux test runs were supplied in the description and were not independently reproduced. Windows, macOS, CI, title-process behavior, and unmeasured memory types and call paths were not verified. The changed files reviewed were `core/libs/prx/libkernel/DirectMemory/Export.cpp`, `core/libs/tests/GuestMemory.cpp`, and `docs/dev/debt/libkernel.md`; `files.json` was not available through the reader, so excluded-file details were not verified. ## To get this to a good state Nothing is required.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!19183
No description provided.