From owner-freebsd-bugs@freebsd.org Fri Apr 6 14:10:18 2018 Return-Path: Delivered-To: freebsd-bugs@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 DD706F88B7E for ; Fri, 6 Apr 2018 14:10:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 858107D70A for ; Fri, 6 Apr 2018 14:10:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 4A1F0F88B76; Fri, 6 Apr 2018 14:10:17 +0000 (UTC) Delivered-To: bugs@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 23286F88B6F for ; Fri, 6 Apr 2018 14:10:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEB087D700 for ; Fri, 6 Apr 2018 14:10:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id C191D1FF52 for ; Fri, 6 Apr 2018 14:10:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w36EAFSO072038 for ; Fri, 6 Apr 2018 14:10:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w36EAFnl072037 for bugs@FreeBSD.org; Fri, 6 Apr 2018 14:10:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 227259] accept()/poll() and shutdown()/close() - not work as in FreeBSD10, may broke many apps Date: Fri, 06 Apr 2018 14:10:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: jtl@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 14:10:18 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D227259 --- Comment #9 from Jonathan T. Looney --- My best guess is that this is due to a new check in soshutdown() added in stable/11: sys/kern/uipc_socket.c: 2351 if ((so->so_state & 2352 (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING)= ) =3D=3D 0) { 2353 /* 2354 * POSIX mandates us to return ENOTCONN when shutdown(2) is 2355 * invoked on a datagram sockets, however historica= lly we would 2356 * actually tear socket down. This is known to be leveraged by 2357 * some applications to unblock process waiting in recvXXX(2) 2358 * by other process that it shares that socket with. Try to meet 2359 * both backward-compatibility and POSIX requiremen= ts by forcing 2360 * ENOTCONN but still asking protocol to perform pru_shutdown(). 2361 */ 2362 if (so->so_type !=3D SOCK_DGRAM) 2363 return (ENOTCONN); 2364 soerror_enotconn =3D 1; 2365 } I don't think I ever really considered someone calling shutdown() on a listening socket. I would have expected them to use close(). My guess is th= at whoever added this didn't consider that case, either. FWIW, this check was added in r285910. I suppose the simple fix is to add a check for SOLISTENING(so) (head) or so->so_options & SO_ACCEPTCON (stable/11). However, we should consult with someone to see what POSIX requires in this case. --=20 You are receiving this mail because: You are the assignee for the bug.=