5 Commits
Author SHA1 Message Date
xXPBSXxandClaude Sonnet 5.5 c424bd17c8 fix(libc): never fall back to an unchecked copy-out on non-EFAULT host errors
GuestCopyOut_nid_no_patch fell back to memcpy when process_vm_writev failed
with anything but EFAULT, and on every non-Linux/non-Windows host. Throw
instead (macOS uses mach_vm_write as Udp.cpp does) and cover read-only and
PROT_NONE pages plus a seccomp EPERM child in guest_fstat_fault.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-25 01:10:37 +02:00
xXPBSXxandClaude Sonnet 5.5 83f28bd67f fix(libkernel): fail the stat family with EFAULT when the output struct is not writable guest memory
fstat, _fstat, sceKernelFstat, stat, lstat, sceKernelStat and _fstatfs
filled the caller's struct in place, or copied into it after a check that
only tests for null, so a pointer into unmapped memory crashed the host.
Fill a local struct and copy it out with a checked write that fails with
EFAULT. FreeBSD 11.4 does the same after the lookup has succeeded:
copyout(&ub, uap->sb) in sys_fstat (sys/kern/kern_descrip.c:1328),
copyout(&sb, uap->ub) in sys_stat (sys/kern/vfs_syscalls.c:2066) and
copyout(sfp, uap->buf) in sys_fstatfs (sys/kern/vfs_syscalls.c:337).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-25 01:08:01 +02:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
xXPBSXxandClaude Sonnet 5.5 c771063042 test(libkernel): check the closed-descriptor EBADF of fstatfs on Windows too
guest_fstatfs and guest_fstat_fault skipped the "closed descriptor fails
with EBADF" checks on Windows (#ifndef _WIN32). Both pass there, so the
guards are removed and the checks run on every host.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 22:53:20 +02:00
milescovielloandClaude Opus 5.5 be17961e32 fix(libkernel): return EFAULT from fstat for a null stat buffer
FreeBSD's fstat looks the descriptor up before it copies the result
out, so a bad descriptor still fails with EBADF and an open one fails
with EFAULT when sb is null. fstat and sceKernelFstat threw
std::invalid_argument instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 06:19:41 +00:00