Repository navigation
fix(libkernel): check operation mode output buffers - #18814
Merged
oneandonlydean merged 1 commit intoNov 12, 2026
Merged
Conversation
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
PrivacyOnion
approved these changes
Nov 12, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against da41fa6c37:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_operation_mode_testsbuilt cleanly. - CTest (
guest_operation_mode):1/1 Test #4562: guest_operation_mode ............. Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libkernel/System/src/Process.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #4562: guest_operation_mode .............***Exception: SegFault 0.14 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- core/libs/prx/libkernel/System/src/Process.cpp: Verified sceKernelGetOperationMode validates mode and submode against nullptr first, preserving the existing std::invalid_argument exception path before any guest copies are attempted.
- core/libs/prx/libkernel/System/src/Process.cpp: Verified GuestCopyOut_nid_no_patch is invoked for both mode and submode with correct sizes (sizeof(int) = 4 bytes), safely catching unmapped or read-only guest addresses without native host crashes.
- core/libs/prx/libkernel/System/src/Process.cpp: Verified copy ordering (mode = 2, then submode = 0) is preserved and unwritable destinations throw std::invalid_argument("sceKernelGetOperationMode: output is not writable").
- core/libs/prx/libkernel/System/src/Process.cpp: Verified cross-platform integer sizing consistency (int is 32-bit on both LP64 Linux and LLP64 Windows) and confirmed zero comments were introduced, adhering strictly to AGENTS.md.
- core/libs/tests/GuestOperationMode.cpp: Verified test additions rigorously exercise inaccessible destination addresses for both mode and submode parameters alongside existing null and valid buffer assertions.
- Note: the AI-assisted checkbox can stay.
Looks Good To Me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Write the mode and submode with the checked guest copy. An inaccessible destination uses the same invalid_argument error path as a null output, instead of causing a native access violation. Valid outputs are still written in order.
Tested
Windows x64, WinLibs GCC 15.2, Release. guest_operation_mode passed three consecutive runs with both bad-output cases. The unpatched source produced a native access violation with the regression test in place. Conventions passed against upstream main. The overlap scan flagged #15095 on the same file, whose Process.cpp hunk only changes the guest environment.
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)