From nobody Tue Jan 24 05:43:23 2023 X-Original-To: dev-commits-src-branches@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 4P1G982LQFz3bNSN; Tue, 24 Jan 2023 05:43:24 +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 4P1G9817Cmz4Tb6; Tue, 24 Jan 2023 05:43:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674539004; 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=NqVG4bjZGBSL/8ckGsQ70Ls/HTG0tGgg3+rqJR6l60E=; b=BbR8BVSFS/6F5TNYB/nkQ3+m7LTBHFnTGnQQyt4RWZEj2+2EB+5k+dlnunsrv1c/T/RX66 KS+wmd80cKwxq+jPXXGtB9/5Gy9ZaxtB8MxHitkdCNbY3FKWeJZbwYhgjx1WstJgGUsC23 uobOo32t649ZwVEKyLag5IteIUBg/viOeyO4VZx4wCWJxRhQFgML1+ym2O5q8zxxfHjED2 frsEgj/ZfC0ygwpeoOaE3GnTdLBTkrubjAaWwbIozscCNqS9HJQIC+aMIFGCr9IHCceD+o 7xVocToPPDOyX4+yNZzFW9rb1qE1o3+vvkQ0/T3o3VBFNP3Ozs7M+4aq2hyVPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674539004; 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=NqVG4bjZGBSL/8ckGsQ70Ls/HTG0tGgg3+rqJR6l60E=; b=RsNQmWlCF7GgyB6n6yl7ei5d0Yt63OEMq2fqpnth0dlvqojMxyaH2TaiQHe0NfdA3vyuJx yfFw8h62VTRW6W9OVMgLzFQMXMaUE1lU7cDXNCWv0vKXkl/b984evVlfVDTSnz41rLg9Vk KDnzsMffY7gk/gXQoNSx238L13HceK8t/lYWqz5qlOHa1hQcCQIvtIXPEYCO5loss2+6iG Wr8QksjzCaFxf0rq9fbN4HOI5cma0DCOfCk6D9m8NFEJyTQ+UuO+pCaEH9C80cuJufU6Pe bV43UYDAgLG1wKPePmT4268tF7CGo/KItcmG4fgQo1d2qHDdMbkvT2Ns2oYGvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674539004; a=rsa-sha256; cv=none; b=akemEYj2xreVszY8TJN6SJ5rbSxGa+CMe5bvFRbiWfsfhIgG1ZgeQUaAmuJ3jwxy+INL8P dPK4dN87IBatWwvw8nFcDcnJJsbyreKL3K3XKUxcxIiJxD5ouIlrNFbJYLvZJSutl9P8hi F2L+yYGnRzkMLcccUyX5GSGe7aBB6ZwDdpbJUvJ+nCyp2FDyAzdOkWGH4OM/is0GyzBxZQ +4wfpBphiCEQhsiUO8XJS/ceFuzdlVtCIY09ImjQlbfBahp0lc1mbwOybOpi9Kb/JIorkE Lr4jgs4AFWfgVoPLBQeKMBrvw3gcxU/4cdx+oIr8x1L0kf5GYXALiQEyRF+3zg== 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 4P1G976x2FzyCx; Tue, 24 Jan 2023 05:43:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30O5hNQx062024; Tue, 24 Jan 2023 05:43:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30O5hNKg062023; Tue, 24 Jan 2023 05:43:23 GMT (envelope-from git) Date: Tue, 24 Jan 2023 05:43:23 GMT Message-Id: <202301240543.30O5hNKg062023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 28327968c2cb - stable/13 - ktls: Post receive errors on partially closed sockets. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 28327968c2cbac4e4edf3bc55504bedcbd3d8c30 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=28327968c2cbac4e4edf3bc55504bedcbd3d8c30 commit 28327968c2cbac4e4edf3bc55504bedcbd3d8c30 Author: John Baldwin AuthorDate: 2022-12-28 00:00:17 +0000 Commit: John Baldwin CommitDate: 2023-01-24 05:24:42 +0000 ktls: Post receive errors on partially closed sockets. If an error such as an invalid record or one whose decryption fails is detected on a socket that has received a RST then ktls_drop() could ignore the error since INP_DROPPED could already be set. In this case soreceive_generic hangs since it does not return from a KTLS socket with pending encrypted data unless there is an error (so_error) (this behavior is to ensure that soreceive_generic doesn't return a premature EOF when there is pending data still being decrypted). Note that this was a bug prior to 69542f26820b7edb8351398b36edda5299c1db56 as tcp_usr_abort would also have ignored the error in this case. Reviewed by: gallatin Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D37775 (cherry picked from commit 07be7517270e7cc8f51612efce9e6375ad1fc12e) --- sys/kern/uipc_ktls.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 711b38ec7f99..901a2df0bd74 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1881,8 +1881,12 @@ ktls_drop(struct socket *so, int error) CURVNET_RESTORE(); if (tp != NULL) INP_WUNLOCK(inp); - } else + } else { + so->so_error = error; + SOCKBUF_LOCK(&so->so_rcv); + sorwakeup_locked(so); INP_WUNLOCK(inp); + } NET_EPOCH_EXIT(et); }