fix(libkernel): return EFAULT from sceKernelGetAppInfo for invalid memory pointers #13798
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13798"
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 pushkarreddyy on 2026-10-31T07:12:52Z.
What
Fixes #13795.
sceKernelGetAppInfodirectly dereferenced the guest output pointerinfoviastd::memsetandstd::memcpy. When a guest passed a non-null pointer into unmapped or read-only memory, the host process crashed withSIGSEGV/0xC0000005.This change:
WriteGuest.SCE_KERNEL_ERROR_EFAULT(0x8002000e) when destination memory is inaccessible.core/libs/tests/GuestAppInfo.cppcovering invalid destination pointers (0x10) for both current PID and PID 0.docs/dev/debt/libkernel.md.Tested
python tools/check_conventions.py --base origin/main.core/libs/tests/GuestAppInfo.cppassertingsceKernelGetAppInforeturnsSCE_KERNEL_ERROR_EFAULTon invalid memory.Checklist
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T09:36:56Z.
Review: COMMENTED
Linux run of head
bed3f89b7, merged (--no-commit) ontomain809c7fa2df. Ubuntu 26.04 (kernel 7.0), GCC 15.2.0, CMake 4.2.3, Ninja, Release,BUILD_TESTING=ON, i7-8700.guest_app_infopasses 3/3.public_headers: 65/65. Subsetguest_app_info|guest_process|guest_kernel_sys|guest_getgroups|trinity: 36/36.Process.cppreverted tomainand the new test kept,guest_app_infocrashes (SEGFAULT) 3/3.errno = savedErrno;line removed,guest_app_infoaborts 3/3, so the newerrno == 71checks do catch the Linux leak.GuestCopyIn/GuestCopyOutin libc, andsceKernelGetAppInfogoes through libkernel's ownWriteGuestinProcess.cpp, which callsprocess_vm_writevdirectly. Withmain+ #13664 + this PR, minus the twosavedErrnolines,guest_app_infostill aborts 3/3.main+ #13769 + #13798 (both touchProcess.cpp): clean, full build ok, the subset 36/36 three times,public_headers65/65.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.