HomeFreeBSD

Don't check rcv sockbuf limits when sending on a unix stream socket.

Description

Don't check rcv sockbuf limits when sending on a unix stream socket.

sosend_generic() performs an initial comparison of the amount of data
(including control messages) to be transmitted with the send buffer
size. When transmitting on a unix socket, we then compare the amount
of data being sent with the amount of space in the receive buffer size;
if insufficient space is available, sbappendcontrol() returns an error
and the data is lost. This is easily triggered by sending control
messages together with an amount of data roughly equal to the send
buffer size, since the control message size may change in uipc_send()
as file descriptors are internalized.

Fix the problem by removing the space check in sbappendcontrol(),
whose only consumer is the unix sockets code. The stream sockets code
uses the SB_STOP mechanism to ensure that senders will block if the
receive buffer fills up.

PR: 181741
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16515

Details

Provenance
markjAuthored on
Differential Revision
D16515: Don't check rcv sockbuf limits when sending on a unix stream socket.
Parents
rS337327: Style.
Branches
Unknown
Tags
Unknown