[Bug 212716] recv() with MSG_WAITALL doesn't always unblock on EOF

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 31 Aug 2023 16:07:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212716

Mark Johnston <markj@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open
                 CC|                            |markj@FreeBSD.org

--- Comment #9 from Mark Johnston <markj@FreeBSD.org> ---
(In reply to Greg Becker from comment #6)
In addition, sbwait() should probably assert that SBS_CANTRECVMORE and
SBS_CANTSENDMORE are not set for SO_RCV and SO_SND directions, respectively.

Regarding the patch, the new check should happen in the "pr->pr_flags &
PR_WANTRCVD" block, since that's where the sockbuf lock is dropped.  Otherwise
the existing check is effectively duplicated.

The general behaviour of soreceive_generic() appears to be to consume data as
long as it's present, even in the face of SBS_CANTRECVMORE and socket errors;
see the "goto dontblock" statements near the beginning of the function. 
soreceive_stream() similarly drains the receive buffer before handling
termination.  I'd argue for the same approach in the MSG_WAITALL loop.

-- 
You are receiving this mail because:
You are the assignee for the bug.