fix(libSceShellUIUtil): guard guest write check with GuestArena::HostWrite #27996

Merged
NobleBrains merged 1 commit from upstream-pr/27996 into main 2026-11-29 09:38:00 +00:00
NobleBrains commented 2026-11-28 02:09:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by NobleBrains on 2026-11-28T02:09:22Z.


What

Guard guest write checks in libSceShellUIUtil with GuestArena::HostWrite so invalid or unmapped guest pointers fail cleanly instead of crashing the host.

Tested

  • Linux: guest_shell_ui_util (1/1 passed)

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 and the licence notice of code adapted from upstream
  • Unimplemented paths throw (NotImplemented_nid_no_patch)
  • No notes, investigation .md files or images added to the repository
  • 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
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • Guest write validation now checks host write access as well as guest writability, improving the accuracy of write checks.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5535682318 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27996). Originally posted by [NobleBrains](https://github.com/NobleBrains) on 2026-11-28T02:09:22Z. --- ### What Guard guest write checks in `libSceShellUIUtil` with `GuestArena::HostWrite` so invalid or unmapped guest pointers fail cleanly instead of crashing the host. ### Tested - Linux: `guest_shell_ui_util` (1/1 passed) ### 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 and the licence notice of code adapted from upstream - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Guest write validation now checks host write access as well as guest writability, improving the accuracy of write checks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Plyxen commented 2026-11-28 05:39:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T05:39:03Z.

Review: APPROVED


Checked head 7c0692ec78. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main 4c7578e0a4 together with #27997, #27978, #27975, #27973, #27971, #27969, #27967, #27964, #27958, #27950, #27949, #27946, #27945, #27943, #27938, #27936. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. guest_shell_ui_util passes. This is the platform where the change matters: on Windows GuestWritable_nid_no_patch reads the page protection, so a write-watched guest page (PAGE_READONLY) reads as unwritable unless HostWrite is open. The guard closes when IsValidGuestWrite returns, which is fine here because sceShellUIUtilGetAppUrl writes nothing before CallService. None of the existing tests puts output or outputSize under a write watch, so the guarded path itself is not exercised. In the full CPU suite (5,131 tests) the only failures are unrelated: windows_read_trap_unknown fails on main too (fixed in #28028), and frame_capture_minimize is a timeout under load that passes on its own.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6096089948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27996#pullrequestreview-6096089948). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-28T05:39:03Z. **Review:** APPROVED --- Checked head `7c0692ec78`. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to `main` `4c7578e0a4` together with #27997, #27978, #27975, #27973, #27971, #27969, #27967, #27964, #27958, #27950, #27949, #27946, #27945, #27943, #27938, #27936. `tools/check_conventions.py --head` and `tools/debt_fold.py --check` passed and the full build succeeded. `guest_shell_ui_util` passes. This is the platform where the change matters: on Windows `GuestWritable_nid_no_patch` reads the page protection, so a write-watched guest page (`PAGE_READONLY`) reads as unwritable unless `HostWrite` is open. The guard closes when `IsValidGuestWrite` returns, which is fine here because `sceShellUIUtilGetAppUrl` writes nothing before `CallService`. None of the existing tests puts `output` or `outputSize` under a write watch, so the guarded path itself is not exercised. In the full CPU suite (5,131 tests) the only failures are unrelated: `windows_read_trap_unknown` fails on `main` too (fixed in #28028), and `frame_capture_minimize` is a timeout under load that passes on its own. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-28 10:39:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T10:39:11Z.

Review: COMMENTED


Reviewed — no blocking findings

The change adds a host write guard before guest write validation; I found no verified blocking defect in the changed code.

What I ran

Reviewed head 7c0692ec785d83cdbe686b3eae414c945e5e4787. I did not run commands or tests; this session provided repository reader tools only. The author reports the Linux guest_shell_ui_util test passed. I read core/libs/prx/libSceShellUIUtil/Export.cpp and targeted context in core/libs/prx/libc/include/GuestArena.hpp, core/libs/prx/libc/src/General.cpp, and core/libs/prx/libc/src/GuestArena.cpp. The manifest lists one changed file and marks its full text included; no exclusions are listed there.

Results

Check Result Note
Changed code review passed One changed file read
Test execution not run Author reports Linux test passed
Negative control not run No test command available

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

I did not execute the reported test or verify behavior on Windows, macOS, or a physical console. No changed files were excluded from review according to the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6097273367 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27996#pullrequestreview-6097273367). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-28T10:39:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The change adds a host write guard before guest write validation; I found no verified blocking defect in the changed code. ## What I ran Reviewed head `7c0692ec785d83cdbe686b3eae414c945e5e4787`. I did not run commands or tests; this session provided repository reader tools only. The author reports the Linux `guest_shell_ui_util` test passed. I read `core/libs/prx/libSceShellUIUtil/Export.cpp` and targeted context in `core/libs/prx/libc/include/GuestArena.hpp`, `core/libs/prx/libc/src/General.cpp`, and `core/libs/prx/libc/src/GuestArena.cpp`. The manifest lists one changed file and marks its full text included; no exclusions are listed there. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | One changed file read | | Test execution | not run | Author reports Linux test passed | | Negative control | not run | No test command available | ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Changed validation code](https://github.com/boykopovar/AnyPS5/blob/7c0692ec785d83cdbe686b3eae414c945e5e4787/core/libs/prx/libSceShellUIUtil/Export.cpp#L29-L32) - [HostWrite implementation](https://github.com/boykopovar/AnyPS5/blob/7c0692ec785d83cdbe686b3eae414c945e5e4787/core/libs/prx/libc/include/GuestArena.hpp#L110-L124) - [Guest write validation](https://github.com/boykopovar/AnyPS5/blob/7c0692ec785d83cdbe686b3eae414c945e5e4787/core/libs/prx/libc/src/General.cpp#L960-L985) ## Not verified I did not execute the reported test or verify behavior on Windows, macOS, or a physical console. No changed files were excluded from review according to the manifest. ## 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!27996
No description provided.