fix(libkernel): return EFAULT from memory protection and stack queries for invalid memory #13904
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13904"
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 DeveshB-1 on 2026-10-31T12:22:14Z.
What
Safely copy out memory protection and stack boundary query results using
GuestCopyOut_nid_no_patchinsceKernelQueryMemoryProtectionandsceKernelIsStack, returningSCE_KERNEL_ERROR_EFAULTwhen the caller provides invalid output memory pointers.Tested
Linux (Ubuntu 24.04, x86_64). Added negative control assertions passing invalid pointers (
0x10) toGuestKernelIsStack.cpp. Verified that the unpatched base crashed withSIGSEGVand that the change cleanly returnsSCE_KERNEL_ERROR_EFAULT. Verifiedguest_kernel_is_stackandguest_protection_reportpass cleanly across repeated test runs. Ranpython3 tools/check_conventions.py --base origin/mainandpython3 tools/pr_overlap.py --branch fix/memory-protection-query-efault(no overlap).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 MarcZX10 on 2026-10-31T12:29:00Z.
Review: APPROVED
Reviewed — looks good
The exact head
c331346597bd007c80c9f7abba445f856b1a6535safely copies each optional query result to guest memory and returnsEFAULTwhen a destination is invalid.The no-build precheck passed the diff, conventions, and mergeability checks. The author reports repeated Linux tests including invalid-pointer cases; hosted Windows passed, while Linux and specialized build jobs were skipped. I did not run a local C++ build or test binary.