Date: Mon, 11 Jun 2018 12:54:33 -0400 From: Mark Johnston <markj@freebsd.org> To: Matt Macy <mmacy@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334960 - head/sys/kern Message-ID: <20180611165433.GD55005@raichu> In-Reply-To: <201806111631.w5BGVh2M051386@repo.freebsd.org> References: <201806111631.w5BGVh2M051386@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 11, 2018 at 04:31:43PM +0000, Matt Macy wrote: > Author: mmacy > Date: Mon Jun 11 16:31:42 2018 > New Revision: 334960 > URL: https://svnweb.freebsd.org/changeset/base/334960 > > Log: > soreceive_stream: correctly handle edge cases > > - non NULL controlp is not an error, returning EINVAL > would cause X forwarding to fail > > - MSG_PEEK and MSG_WAITALL are fairly exceptional, but we still > want to handle them - punt to soreceive_generic > > Modified: > head/sys/kern/uipc_socket.c > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Mon Jun 11 16:27:09 2018 (r334959) > +++ head/sys/kern/uipc_socket.c Mon Jun 11 16:31:42 2018 (r334960) > @@ -2162,7 +2162,6 @@ release: > > /* > * Optimized version of soreceive() for stream (TCP) sockets. > - * XXXAO: (MSG_WAITALL | MSG_PEEK) isn't properly handled. > */ > int > soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, > @@ -2177,12 +2176,14 @@ soreceive_stream(struct socket *so, struct sockaddr ** > return (EINVAL); > if (psa != NULL) > *psa = NULL; > - if (controlp != NULL) > - return (EINVAL); > if (flagsp != NULL) > flags = *flagsp &~ MSG_EOR; > else > flags = 0; > + if (flags & (MSG_PEEK|MSG_WAITALL)) > + return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp)); > + if (controlp != NULL) > + *controlp = NULL; Now soreceive_stream() contains dead code to handle MSG_WAITALL, and a bunch of always-true checks for both flags. Changes to this code should be reviewed.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180611165433.GD55005>