From owner-svn-src-head@freebsd.org Mon Jun 11 17:04:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 862A5101BAC4; Mon, 11 Jun 2018 17:04:38 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34A4B70C20; Mon, 11 Jun 2018 17:04:38 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id F29B114F69; Mon, 11 Jun 2018 17:04:37 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-it0-f42.google.com with SMTP id 76-v6so11213965itx.4; Mon, 11 Jun 2018 10:04:37 -0700 (PDT) X-Gm-Message-State: APt69E1B9VW6Y1TFv2i5+d+4z0uhK9EFYBGlZ3c/w8di9tU3JXVkLa7/ bTseZ1mGBsqB0moi1wW4PiGj61R3wXBMyTAYZLI= X-Google-Smtp-Source: ADUXVKKHj+XrSOniv1l9Q4pQKI0xIQM39w2f2ehStxRGBTDIoaVKagXcbHzzfnxmMbCkMF/yZkYSS4cWXkQtpnWxguE= X-Received: by 2002:a24:6c8a:: with SMTP id w132-v6mr35928itb.4.1528736677195; Mon, 11 Jun 2018 10:04:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:8cd:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 10:04:36 -0700 (PDT) In-Reply-To: <20180611165433.GD55005@raichu> References: <201806111631.w5BGVh2M051386@repo.freebsd.org> <20180611165433.GD55005@raichu> From: Matthew Macy Date: Mon, 11 Jun 2018 10:04:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334960 - head/sys/kern To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 17:04:38 -0000 Fair. But it didn't actually work before. It's not clear anyone has ever used it. On Mon, Jun 11, 2018 at 9:54 AM, Mark Johnston wrote: > 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.