fix(libkernel): fstat, stat, lstat, fstatfs and their sceKernel* forms crash on an output pointer into unmapped memory instead of failing with EFAULT #9617
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 xXPBSXx on 2026-10-22T04:39:14Z.
A bad-pointer sweep over the libkernel exports (983 functions, pointer parameter replaced by
1and0xfffffffffffff000, one child process per call) found thatfstat_nid_disambig1,_fstat,sceKernelFstat,stat,lstat,sceKernelStatand_fstatfswrite the caller's struct without checking it, or check only for null (_fstatfscallsGuestArena::HostWrite::Open(), which returns true for any non-arena host pointer). They crash the host process (SIGSEGV on Linux, access violation on Windows). FreeBSD 11.4 returns EFAULT fromcopyoutafter the lookup succeeded:sys_fstat(sys/kern/kern_descrip.c:1328),sys_stat(sys/kern/vfs_syscalls.c:2066),sys_fstatfs(sys/kern/vfs_syscalls.c:337). This is the family of #8463 (sendmsg).This issue covers only the stat family; other output-pointer families (
getrlimit,getrusage,gettimeofday,getitimer,setitimer,pipe,getsockname) and the path-string arguments are separate topics.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T13:13:26Z.
The focused report is now covered by #9618, which adds regression cases for the stat-family wrappers and reports red/green runs on Windows and Linux. During review, I found the helper still falls through to unchecked
memcpyon macOS/non-Windows/non-Linux hosts, and on Linux whenprocess_vm_writevfails with an error other thanEFAULT(for example, a seccompEPERM). I requested fixes and read-only destination coverage on #9618. This issue should stay open until the merged implementation safely handles those supported-host paths as well.