Files
AnyPS5/docs/dev/debt/changes/fix-libkernel-send-recv-buffer-checks.md
CocoandClaude Opus 5.5 2c7575b2ea fix(libkernel): check the send and recv buffers as sendto and recvfrom do
send and recv handed the guest buffer to the host call unchecked, so an
unreadable or unwritable buffer got whatever the host did, where sendto
and recvfrom fail with EFAULT. FreeBSD 11.4's libc send and recv are
sendto and recvfrom without an address, so give them the same checks:
on Windows send rejects a buffer that is not wholly readable through
SourceFaults, which also prepares guest memory for the host read, and
recv receives only into the writable prefix, failing with EFAULT and
leaving stream data queued (dropping a datagram) when the pending data
does not fit it. Linux was already the same as sendto and recvfrom;
macOS still keeps a faulted datagram in recv, as the debt entry says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:45:36 +05:30

577 B

libkernel

change [send and recv]

  • send, recv, sendto and recvfrom (libkernel) - on Windows a stream receive whose writable prefix is shorter than the queued data fails with EFAULT, but data arriving after the check, or MSG_WAITALL, can return the prefix as a short success where FreeBSD fails. Linux and macOS return the bytes copied before a fault on a stream, where FreeBSD returns EFAULT. On macOS a datagram whose copy into a recv buffer faults stays queued, where recvfrom drops it as FreeBSD does.