From nobody Wed Apr 24 00:19:05 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VPKNT4bHsz5JNDB; Wed, 24 Apr 2024 00:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VPKNT446xz3xyF; Wed, 24 Apr 2024 00:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713917945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ajjwMg7FzO/EsP0G/41YDXEf02e/Oj3CK8Rdgql070A=; b=xsnwlSjHUhqbLGVWItLemaN/obM9UZsBUuNaAB10CluOqinn4O1k1yxpXGfBIUJukJc5o6 npbarviRVXLXyemhy7tVaHi/bKYE2OIyxEVFXpZrDuOx26AfOuBjafOVsslsWiSDylLEXE yOKS6IuqqJ6xgHwwOxpw7rgA+lOkDZDbhlbTxVmhCKzsojIfbrtfEzejPBAjXs8iAJ2BXr N/oKiJNNclidNKLcmVnUkzUHDR6Xh+YKmv2ZzHo3+AgNuzn9Y7gCwp1pa4pgL60eHfz4CQ qxVLOy6rNpIHh3o9kxp0S2XiVMyrV89xa6W2UA2+t+7UYyqIPI6pmcKiFPtg6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713917945; a=rsa-sha256; cv=none; b=UADk/An4jOXQ5f9SDDZpkRAQVevSeSD1hV/G6cm4jv3SctraHivudfdut0tr5QVHrB2FNC /MMQnu51Qd6opEgfedeXR+m6MS+6czaHJjeghYdqpkiFEkIaR9pR5kWGxfWxiv8AjVgImZ m75EB/OEDUdudC+iFx8xFKj9jxebdCyTAzeI5Z6PiR2GjxyZOU148rpRTjsJ8NjUnuY+wb Rlt/2oBs3LixdpdE5/MeiPEhyBQTEmwfeejuUopkJsrXKOgCE8wJSMK2sQ/dtd4dopNEfD 6qJ8VscHao6U5w278yAaFajnplAW7PZzZziYNVAYP2qX77qYfr0wUNF5nZZnhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713917945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ajjwMg7FzO/EsP0G/41YDXEf02e/Oj3CK8Rdgql070A=; b=AMgTgSlFtKFTucpYUqxuHAjSOAsiUdgpoozRo/SFgqAUoj1ymKNbVOCeAr6V47LfOve6IG SpZKFyDHG1OZ8AgRI3B21Q9EDD4KTGGTZWV5tfgoN+aXeFIKvpsdi72DFMOacI8aHfTDaY Pn6cDgtjE1iN71X6m2nldj+VzMMenhxFWFTOuAolqH/EFfTLstfCS34754yCf8n0dYGehZ yENOwyYXHSOPQ+jgjtZxTZ4QetC+X1ySO4J64QM4vXr5vdf1rVlw/a3i9rjqZE7r98dwBe GVYKsgRF/cSBslXwlsoaNB26opVs2S8OrvIHO54BPoEMvct7WGDx5JKPgRnNUQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VPKNT3fnqzt3Q; Wed, 24 Apr 2024 00:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43O0J5WG034185; Wed, 24 Apr 2024 00:19:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43O0J50g034182; Wed, 24 Apr 2024 00:19:05 GMT (envelope-from git) Date: Wed, 24 Apr 2024 00:19:05 GMT Message-Id: <202404240019.43O0J50g034182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: a8acc2bf5699 - main - sockets: inherit SO_ACCEPTFILTER from listener to child List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8acc2bf5699556946dda2a37589d3c3bd9762c6 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a8acc2bf5699556946dda2a37589d3c3bd9762c6 commit a8acc2bf5699556946dda2a37589d3c3bd9762c6 Author: Gleb Smirnoff AuthorDate: 2024-04-24 00:17:14 +0000 Commit: Gleb Smirnoff CommitDate: 2024-04-24 00:17:14 +0000 sockets: inherit SO_ACCEPTFILTER from listener to child This is crucial for operation of accept_filter(9). See added comment. Fixes: d29b95ecc0d049406d27a6c11939d40a46658733 --- sys/kern/uipc_socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index c040bdf4d3eb..f0b36fc5595e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -761,9 +761,13 @@ solisten_clone(struct socket *head) * including those completely irrelevant to a new born socket. For * compatibility with older versions we will inherit a list of * meaningful options. + * The crucial bit to inherit is SO_ACCEPTFILTER. We need it present + * in the child socket for soisconnected() promoting socket from the + * incomplete queue to complete. It will be cleared before the child + * gets available to accept(2). */ - so->so_options = head->so_options & (SO_KEEPALIVE | SO_DONTROUTE | - SO_LINGER | SO_OOBINLINE | SO_NOSIGPIPE); + so->so_options = head->so_options & (SO_ACCEPTFILTER | SO_KEEPALIVE | + SO_DONTROUTE | SO_LINGER | SO_OOBINLINE | SO_NOSIGPIPE); so->so_linger = head->so_linger; so->so_state = head->so_state; so->so_fibnum = head->so_fibnum;