fix(libkernel): accept GPU coherency prot bits for host mapping #550

Merged
Pouare514 merged 2 commits from upstream-pr/550 into main 2026-10-07 15:54:42 +00:00
Pouare514 commented 2026-10-04 19:04:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pouare514 on 2026-10-04T19:04:37Z.


What

Deathloop maps direct memory with prot 0x3f2 (read/write plus GPU/coherency bits 8-9). LinuxProtFromSce rejected anything outside 0xF7, aborting the title. The extra bits do not affect host CPU page tables (protection is derived solely from the known R/W/X bits, as with the already-tolerated bits 6-7), so they are now accepted and ignored for the host mapping.

Tested

  • New guest_memory case CheckDirectMemoryGpuProtBits: maps with prot 0x3f2, writes/reads a byte. Verified it aborts without the fix (0xc0000409) and passes with it.
  • Deathloop PPSA01670 runtime: progresses past the mapping wall.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4736840226 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550). Originally posted by [Pouare514](https://github.com/Pouare514) on 2026-10-04T19:04:37Z. --- ### What Deathloop maps direct memory with prot 0x3f2 (read/write plus GPU/coherency bits 8-9). LinuxProtFromSce rejected anything outside 0xF7, aborting the title. The extra bits do not affect host CPU page tables (protection is derived solely from the known R/W/X bits, as with the already-tolerated bits 6-7), so they are now accepted and ignored for the host mapping. ### Tested - New guest_memory case CheckDirectMemoryGpuProtBits: maps with prot 0x3f2, writes/reads a byte. Verified it aborts without the fix (0xc0000409) and passes with it. - Deathloop PPSA01670 runtime: progresses past the mapping wall. ### Checklist - [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 - [x] Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt - [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 - [ ] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-04 21:19:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:19:33Z.


Thanks. The change is safe for CPU access (the host protection still comes only from the read, write and exec bits, as for bits 6 and 7), and the new guest_memory case fails without it. The only thing missing is where bits 8 and 9 come from: the description calls them GPU/coherency bits. If that's from a header or the kernel, could you name the source in the description? If it's inferred from the title's values, a line under "Unknown function info" in TechnicalDebt saying that protection bits 0x100 and 0x200 are accepted and assumed not to affect CPU access would cover it. Then it's ready to merge from my side.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984496748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5984496748). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:19:33Z. --- Thanks. The change is safe for CPU access (the host protection still comes only from the read, write and exec bits, as for bits 6 and 7), and the new `guest_memory` case fails without it. The only thing missing is where bits 8 and 9 come from: the description calls them GPU/coherency bits. If that's from a header or the kernel, could you name the source in the description? If it's inferred from the title's values, a line under "Unknown function info" in TechnicalDebt saying that protection bits 0x100 and 0x200 are accepted and assumed not to affect CPU access would cover it. Then it's ready to merge from my side.
Pouare514 commented 2026-10-04 22:54:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pouare514 on 2026-10-04T22:54:41Z.


Done: added an Unknown function info line in TechnicalDebt for protection bits 0x100 and 0x200 (accepted, assumed not to affect host CPU access).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985342143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5985342143). Originally posted by [Pouare514](https://github.com/Pouare514) on 2026-10-04T22:54:41Z. --- Done: added an Unknown function info line in TechnicalDebt for protection bits 0x100 and 0x200 (accepted, assumed not to affect host CPU access).
oneandonlydean commented 2026-10-04 23:43:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:43:49Z.


Thanks, the TechnicalDebt line covers it. It conflicts with main now in TechnicalDebt.md (only that file); after a rebase that keeps both sides it's ready to merge from my side. guest_memory passes here with the conflict resolved that way.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985701281 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5985701281). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T23:43:49Z. --- Thanks, the TechnicalDebt line covers it. It conflicts with main now in TechnicalDebt.md (only that file); after a rebase that keeps both sides it's ready to merge from my side. `guest_memory` passes here with the conflict resolved that way.
Pouare514 commented 2026-10-05 00:23:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pouare514 on 2026-10-05T00:23:00Z.


Rebased onto current main, keeping both sides in TechnicalDebt.md. guest_memory passes locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5986014157 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5986014157). Originally posted by [Pouare514](https://github.com/Pouare514) on 2026-10-05T00:23:00Z. --- Rebased onto current main, keeping both sides in TechnicalDebt.md. guest_memory passes locally.
oneandonlydean commented 2026-10-05 01:18:13 +00:00 (Migrated from github.com)

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


Thanks for the rebase. It's the same change with the TechnicalDebt line, merges cleanly with main now, guest_memory passes here, and CI is green. Ready to merge from my side.

#338, #407 and #545 also append to the end of "Unknown function info", so whichever of them lands after this one will need a one-line TechnicalDebt rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5986480129 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5986480129). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T01:18:13Z. --- Thanks for the rebase. It's the same change with the TechnicalDebt line, merges cleanly with main now, `guest_memory` passes here, and CI is green. Ready to merge from my side. #338, #407 and #545 also append to the end of "Unknown function info", so whichever of them lands after this one will need a one-line TechnicalDebt rebase.
oneandonlydean commented 2026-10-05 02:47:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T02:47:16Z.


#338 is on main now, so this needs the one-line rebase I mentioned: in docs/dev/TechnicalDebt.md, #338 adds ten "unknown signature" lines at the end of "Unknown function info", right where your LinuxProtFromSce line goes. Keep main's lines and add yours after them. Nothing else conflicts, and after that it's ready to merge from my side.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5987228920 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5987228920). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T02:47:16Z. --- #338 is on main now, so this needs the one-line rebase I mentioned: in docs/dev/TechnicalDebt.md, #338 adds ten "unknown signature" lines at the end of "Unknown function info", right where your `LinuxProtFromSce` line goes. Keep main's lines and add yours after them. Nothing else conflicts, and after that it's ready to merge from my side.
Pouare514 commented 2026-10-05 13:23:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pouare514 on 2026-10-05T13:23:52Z.


Rebased onto current main. Kept #338's ten unknown-signature lines in docs/dev/TechnicalDebt.md and placed the LinuxProtFromSce line after them at the end of the Unknown function info section. Nothing else changed: prot mask fix (~0x3F7) and GuestMemory test intact, TD diff is one added line only.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5995362481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-5995362481). Originally posted by [Pouare514](https://github.com/Pouare514) on 2026-10-05T13:23:52Z. --- Rebased onto current main. Kept #338's ten unknown-signature lines in docs/dev/TechnicalDebt.md and placed the LinuxProtFromSce line after them at the end of the Unknown function info section. Nothing else changed: prot mask fix (~0x3F7) and GuestMemory test intact, TD diff is one added line only.
oneandonlydean commented 2026-10-06 05:34:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:34:14Z.


Thanks, the TechnicalDebt resolution is right, and the fix and test are unchanged.

Since then #686 has landed, so it conflicts in two places:

  • core/libs/tests/GuestMemory.cpp: #686 added CheckReleaseDirectMemoryClearsMappings() where your CheckDirectMemoryGpuProtBits() goes. Keep both functions and both calls in main().
  • docs/dev/TechnicalDebt.md: the end of "Unknown function info" has four new lines (_sceUlobjmgrRegisterObject, sceShareGetCurrentStatus, sceAgcDcbSet*PredicationEnableGetSize, Resource registration). Keep them and add your LinuxProtFromSce line after them.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6010064840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-6010064840). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T05:34:14Z. --- Thanks, the TechnicalDebt resolution is right, and the fix and test are unchanged. Since then #686 has landed, so it conflicts in two places: - `core/libs/tests/GuestMemory.cpp`: #686 added `CheckReleaseDirectMemoryClearsMappings()` where your `CheckDirectMemoryGpuProtBits()` goes. Keep both functions and both calls in `main()`. - `docs/dev/TechnicalDebt.md`: the end of "Unknown function info" has four new lines (`_sceUlobjmgrRegisterObject`, `sceShareGetCurrentStatus`, `sceAgcDcbSet*PredicationEnableGetSize`, `Resource registration`). Keep them and add your `LinuxProtFromSce` line after them.
adriadam10 commented 2026-10-07 15:46:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T15:46:25Z.


Rebased onto current main (#686 conflicts): GuestMemory.cpp keeps both CheckReleaseDirectMemoryClearsMappings and CheckDirectMemoryGpuProtBits with both calls; the TechnicalDebt line now sits mid-section (after sceKernelReadv) so later appends don't conflict with it.

  • Build + full ctest green after the rebase; guest_memory fails without the mask change and passes with it.
  • For the record: KytyPS5 (libAmpr) names 0x100/0x200 PROT_ACP_READ/PROT_ACP_WRITE, which supports treating them as non-CPU bits.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6041439576 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-6041439576). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T15:46:25Z. --- Rebased onto current main (#686 conflicts): `GuestMemory.cpp` keeps both `CheckReleaseDirectMemoryClearsMappings` and `CheckDirectMemoryGpuProtBits` with both calls; the TechnicalDebt line now sits mid-section (after `sceKernelReadv`) so later appends don't conflict with it. - Build + full ctest green after the rebase; `guest_memory` fails without the mask change and passes with it. - For the record: KytyPS5 (`libAmpr`) names 0x100/0x200 `PROT_ACP_READ`/`PROT_ACP_WRITE`, which supports treating them as non-CPU bits. Merging once CI is green.
github-actions[bot] commented 2026-10-07 15:53:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T15:53:51Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1131 docs/dev/TechnicalDebt.md L188
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6041577785 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/550#issuecomment-6041577785). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T15:53:51Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1131 | `docs/dev/TechnicalDebt.md` [L188](https://github.com/boykopovar/AnyPS5/blob/4bf75d835e6d84115bda9ea4088de426ef9b32e3/docs/dev/TechnicalDebt.md#L188) | | |
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!550
No description provided.