From nobody Fri Feb 11 23:16:50 2022 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 C3C6319B5C73; Fri, 11 Feb 2022 23:16:50 +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 4JwTyp5DRhz4qyg; Fri, 11 Feb 2022 23:16:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644621410; 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=n0CNAC/M+iWQqI+nHcvotsTbFXjW69arc3y6VC+BIO0=; b=e0OFoRU4e1Bz6K8SHTD9mK/XQIAsGUWUMIesRg79pI2vA+e5asHP/SE/g9n3euqBdBw7jl cpKuy3KtjFeyIBWbtqXbmflKRpm8tE3x3zOqncT/9XMrbO4GuXhBoyjos5wF3LIY/g2jad nWwkGiaMMI+3RdFWpCdyvadUFU9PmWV8z9mWPF09tZZfR36Dk7o+EJotrwxoCec3+cFeTU FLdaFarBfuzUu78rYOMovMm5tnB5eTX3f60KS39wtU+4wEzi+do8igJkT5Zq3B7RQn6WIK pEkBLyZsucnD1Vis2krmyniPDRpS3trWqVsRIo3aryrStCtrRIVSwDiXyAVg4g== 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 8FAB81D18A; Fri, 11 Feb 2022 23:16:50 +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 21BNGo37041914; Fri, 11 Feb 2022 23:16:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21BNGovI041913; Fri, 11 Feb 2022 23:16:50 GMT (envelope-from git) Date: Fri, 11 Feb 2022 23:16:50 GMT Message-Id: <202202112316.21BNGovI041913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: cd0525f615fe - main - ktls: Write-lock the INP when changing a transmit TLS session. 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: cd0525f615fe8fea750d2078b61026aabe0d0471 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644621410; 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=n0CNAC/M+iWQqI+nHcvotsTbFXjW69arc3y6VC+BIO0=; b=HDTLbejmNnfOcBmIHolzZmrDaEFtGm8gIYA4+7mezH5OZQzE/1Ies0F8UWfqUKe3ZsEs3W /FpX/4IEIJX9wFMW/CkB+RLSRajDuBYoI1857UUaeiiESlkttUnUWYAuzrWjkXq47CKhJa 88DcnycKtNN8T9MRHMBWTjuywjXhnBy85BuCB01Hx5hNUsKx27HDve4n3Anrj8pDkGq87e AvAu+6aHrzx9UpIhyrUllXlenn4GX1biSHPWoqECxqtSf0kwOeV8WlXYwTrUH8+2toXK5V abbsZwjqWNYRfcEWimguBCiqnaDsY23TQw9du0SLXvOleKwcGXKAj9DJp51q+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644621410; a=rsa-sha256; cv=none; b=tCIBDEjBti3XCRVha3Wqii+ODB2Tzo9Z5Fni7WYj2IZf0ZylUzyodUdfBjgqXf6icrv4EI 5QpENbQvSQItwh/5EEyT6p995hVXK81+1zLtRTW55KWz4Xk1Ffq5Q4MPSZN98kREXEtsa8 ldBtrX0tbKOzg6KV92WijBDeIYiPDEFnxzKLtxM5QXwdVPd1wS7aH94xMbvZDPuDjF+E3Y pVlvW9fDb0xNniIK/5vEOr+1cUkUHvxRezR1AQ90J5Gvke5mFK3y9fuML1wMCSNVpHTvu0 sdxUrBxvIVm8zRLavZgp7RhcRTJP6CDP01cQoockxhYc1oGCtM0r84XcE2DqWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cd0525f615fe8fea750d2078b61026aabe0d0471 commit cd0525f615fe8fea750d2078b61026aabe0d0471 Author: John Baldwin AuthorDate: 2022-02-11 23:16:25 +0000 Commit: John Baldwin CommitDate: 2022-02-11 23:16:25 +0000 ktls: Write-lock the INP when changing a transmit TLS session. The TCP rate pacing code relies on being able to read this pointer safely while holding an INP lock. The initial TLS session pointer is set while holding the write lock already. Reviewed by: gallatin, hselasky Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D34086 --- sys/kern/uipc_ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 2495e940a6a0..466b64d01386 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1454,6 +1454,7 @@ ktls_set_tx_mode(struct socket *so, int mode) return (EBUSY); } + INP_WLOCK(inp); SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_tls_info = tls_new; if (tls_new->mode != TCP_TLS_MODE_SW) @@ -1475,7 +1476,6 @@ ktls_set_tx_mode(struct socket *so, int mode) else counter_u64_add(ktls_switch_to_sw, 1); - INP_WLOCK(inp); return (0); }