A guest kqueue and a guest /dev/urandom are /dev/null placeholders with
their behaviour in libkernel's tables, and a guest directory descriptor
keeps its reading state there too. sendmsg sent the placeholder, and the
receiver got a descriptor that failed kevent or read as empty. FreeBSD's
unp_internalize returns EOPNOTSUPP for a kqueue (no DFLAG_PASSABLE), so a
kqueue now gets that; a random device or a directory throws.
A zero-byte sendmsg carrying descriptors on a stream socket returned 0
and lost them, as Linux sends no record without data. It throws now.
FreeBSD sends the control data alone there.
guest_socket_rights checks the kqueue refusal and that the next send on
the pair arrives without control data.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A fault on the final message header write, or an installation that fails
part-way, now closes every received descriptor exactly once. A plain-data
MSG_PEEK with control space on a Unix socket reads the data again, as on
main, and the test includes the public headers and counts host descriptors
portably.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since #10308, recvmsg starts msg_flags from the call's flags, as
measured on a PS5 and as FreeBSD's recvmsg does, so a receive with
MSG_CMSG_CLOEXEC reports it there. The two-socket case expected 0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The only MSG_CMSG_CLOEXEC case received sockets, whose F_GETFD reads the
guest's close-on-exec set, so it passed whether or not the received host
descriptor was marked. A pipe end goes through unchanged, so receiving
one with the flag now has to read back FD_CLOEXEC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sendmsg on a guest Unix-domain socket now takes FreeBSD SCM_RIGHTS control
messages (SOL_SOCKET level, data at offset 16) and sends their descriptors
with the host's SCM_RIGHTS; recvmsg receives them, installs received sockets
as guest sockets and writes FreeBSD's control record back, truncated to the
caller's buffer with MSG_CTRUNC. A closed descriptor returns EBADF, another
level or an overlong record EINVAL. Windows, other control types, IP
sockets and MSG_PEEK with a control buffer still throw.
Co-Authored-By: Claude Opus 5.5 <[email protected]>