In a payload process on a PS5 (firmware 12.70), sysctlbyname returns -1
with ENOENT for thirteen names that threw here, and leaves the buffer and
the length alone, for a read, a size query, a null length and a null
buffer with a null length. sysctl does the same for the fixed MIBs of
seven of them. sysctlnametomib gives those seven MIBs and returns ENOENT
for hw.cacheline_size and hw.usermem, which threw too.
machdep.cacheline_size already returned ENOENT and is now tested with
the others. A write to the new names and MIBs throws, as the console's
answer to a write was not tried. The hw.realmem and vm.overcommit debt
entries now say that a payload process gets ENOENT for them as well.
AI-assisted: yes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kevent threw for EVFILT_WRITE on any descriptor that is not a socket. On the write end of a pipe it now follows FreeBSD 11's filt_pipewrite: data is the free buffer space, and once the read end is closed the event reports EV_EOF with data 0. Adding the event after the read end is closed fails with EPIPE, as in pipe_kqfilter. EVFILT_WRITE on the read end still throws, because FreeBSD's pipe ends are bidirectional and host pipes are not.
Host logging opens its own FILE on the saved descriptor. The guest FILE stays on the replaced descriptor, so guest printf, puts and fprintf still reach the pipe.
ftruncate, truncate and sceKernelFtruncate extended a file through _chsize_s,
which writes the whole new length as zero bytes. FreeBSD extends the file
without writing data (kern_ftruncate -> ffs_truncate) and fails a length the
file system cannot hold with EFBIG. NativeFtruncate now sets the end of file
with SetFileInformationByHandle and maps ERROR_DISK_FULL to ENOSPC and
ERROR_FILE_TOO_LARGE/ERROR_INVALID_PARAMETER to EFBIG.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
send, sendto, sendmsg, recv, recvfrom and recvmsg failed with EOPNOTSUPP for
MSG_DONTWAIT on Windows, where FreeBSD 11.4 sosend_generic and
soreceive_generic make the one call non-blocking and fail with EWOULDBLOCK
when it would wait. Winsock has no per-call flag, so the call now asks WSAPoll
with a zero timeout whether the socket is ready and fails with EAGAIN when it
is not. The Windows branches of the socket tests that expected EOPNOTSUPP now
run the same checks as the other hosts.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bind, connect and sendto answered EFAULT for an address length below 2 and EAFNOSUPPORT for an AF_INET address below 16 or an AF_INET6 address below 28 bytes. FreeBSD 11.4's getsockaddr fails a length below 2 with EINVAL and above SOCK_MAXADDRLEN (255) with ENAMETOOLONG, and the protocols compare the length with sizeof(struct sockaddr_in) or sockaddr_in6 and fail with EINVAL.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The entry before it still says sceKernelAddReadEvent and
sceKernelAddWriteEvent take only guest sockets. The pipe entry now says it
is the exception, without editing that entry, which an open change to the
shared-memory entry next to it would conflict with.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
GetModuleHandleExW and GetModuleFileNameW take loader locks the suspended
target may hold. While the target is suspended only VirtualQuery and a
lock-free cache of image bases are consulted; an image not yet cached is
classified after the target is resumed, and the target is sampled again.
The statics the checks use are initialized before the first suspend. The
host-code wait is recorded in the libkernel debt file, and the test raises
100 times so it fails on every run without the change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
In a payload process on a PS5 (firmware 12.70), getrlimit returns
0x200000 for RLIMIT_STACK, infinity for RLIMIT_RSS and RLIMIT_MEMLOCK,
and 1604 for RLIMIT_NPROC, each as both soft and hard limit. These four
threw here. Whether a title process reads the same limits is not
measured.
setrlimit reads getrlimit first, so it now accepts RLIMIT_STACK,
RLIMIT_RSS and RLIMIT_MEMLOCK when the values do not change, as the
payload process does. RLIMIT_NPROC throws: in the payload process
setting it to its current value succeeds, but getrlimit then reads 1443,
and the limit is not stored here. Any other change still throws. The
getrlimit and setrlimit debt entries also record the payload process's
RLIMIT_DATA and RLIMIT_NOFILE readings, its 12555 clamp of RLIMIT_NOFILE
and its RLIMIT_NPROC reading after a same-value set.
AI-assisted: yes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OpenOrbis net_http sample stops on 0x5413, the Linux TIOCGWINSZ
that musl sends to standard output; the carried cases covered 0x5401
but not that word, so the test adds it to the malformed words. It also
pins the two boundary words the check takes as well-formed, 0x20046601
(IOC_VOID, length 4) and 0x80006601 (IOC_IN, length 0): on a guest
socket with a null argument they fail with EFAULT, not ENOTTY.
The debt sentence now states the open gap: an input request with
length 0 is not rejected as malformed, while sys_ioctl rejects it in a
kernel built without COMPAT_FREEBSD4, COMPAT_FREEBSD5 and COMPAT_43,
and which of these the PS5 kernel has is unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FreeBSD's sys_ioctl rejects a request with no direction bit, an output request with no length, or a void request whose length is not an int before it reads the argument or resolves the descriptor. ioctl threw on such a request for a file, pipe or directory, failed with EBADF for a closed descriptor and with EFAULT for a socket given no argument.
(cherry picked from commit 501518f321ac5d0b45ce1090af39c680927edf49)
(cherry picked from commit 3eb7edd9cf)
scePthreadAttrGet copied the attributes of any non-null handle, so a
thread that was joined or had finished still answered 0, and a thread
that ended detached was read after its object had been freed. FreeBSD
11.4's _pthread_attr_get_np returns ESRCH for a dead or reclaimed thread,
and Monster Hunter Wilds (PPSA24191) reuses a slot of its thread table
only when scePthreadAttrGet returns 0x80020003.
After the EINVAL checks it now returns ESRCH unless the handle is a live
guest thread, and copies the fields while holding the thread registry
lock (LockLiveGuestThread), so a detached thread exiting during the call
is not freed under the copy. GuestThreadIsLive uses the same lookup.
pthread_attr_get_np, which the title does not import, is left as it is;
the debt entry records the difference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A search range with no free direct memory returned EAGAIN (0x80020023).
A PS5 returns ENOMEM (0x8002000c) for an occupied range, as the
PS5_RetroArch author's console capture records, and PS5_PayloadSDK's
ps5_memory_query, which RetroArch uses for its memory status, gives up
on any other error.
LargestFree now returns the error: ENOMEM when no block is found, and
EAGAIN as before for a negative start, an end at or below the start and
an alignment that overflows when rounded to a page. guest_memory expects
ENOMEM for an occupied range and EAGAIN for those arguments. The
unmeasured argument handling is recorded in the libkernel debt file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>