From nobody Thu Jan 20 20:43:35 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 156E71960BDA; Thu, 20 Jan 2022 20:43:36 +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 4Jfvc771wdz4YtK; Thu, 20 Jan 2022 20:43:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642711416; 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=HhK3ICQ62+06AK0SXiWyZgOjPkKaZB1ubDIPOsoibrU=; b=Px2H5ETd5dBe90AaZ7RsXELuzZi8PBNrWVThl0bLtCralBDyrUs5q/stsE0u407URGRPZ6 HO7aZCtOltiefCpOWn+SU9hvns1X8dFYVcFTMw3aHczfooxPyyP5kKr7z5dYlkFmanWnMd GNSXKiyeQTxrXnzrlWLqpl4toPwyF/W+oWR4iWZxLxPS42zhn2oDVLmkciepfVb0NNbRKx SjWIH43KyTgFonbbupuGO8dEwq3Asj0AnJasRgig6vo8gmaiYcs0tMeQQaXcE/Lgeym11V l6eFax8fsX1akzfwfZ1n1l+4RIM9NOUFslnQyn3zo/8oW5CKnom3dcqgc9VzmA== 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 D0F957013; Thu, 20 Jan 2022 20:43:35 +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 20KKhZhZ046670; Thu, 20 Jan 2022 20:43:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20KKhZH1046669; Thu, 20 Jan 2022 20:43:35 GMT (envelope-from git) Date: Thu, 20 Jan 2022 20:43:35 GMT Message-Id: <202201202043.20KKhZH1046669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6be8944d96d2 - main - ktls: Zero out TLS_GET_RECORD control messages 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6be8944d96d2cb5938b69c63b483efa616eafb56 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642711416; 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=HhK3ICQ62+06AK0SXiWyZgOjPkKaZB1ubDIPOsoibrU=; b=Fc1Lrf9x7wf/y8dvzX3oM2nmntIwS2GxbpcAV7VGfWLZk06uq6+edb6TeJ9bVQgO7SZ6+R 8Lv5tLAwTle8BokzELn0esA/RxTNgLV4X+vhQn9DdL/Sf3vlF1dV9gVSREpf+dqOG6+k8l sx11V2Hvobtej4eiEJxo5QOohdbm3NKRXOL4KUVZC8wntiKIJkQL24fRR/iWX3UaY1isHP gGicw0mBTnR3cItsoFhzNM6lG8sqRrCM84rV/zUN0RACeb8rsOAijfIgqhHIgeXVl6iuou hCKyk72cRnEPLYx2P0GuB71TrEob0+ZcXwD+rNzbhusCnTRPEvZWfkUBbNZmfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642711416; a=rsa-sha256; cv=none; b=LsEohcDHtvtava4JAebtILKPTEqfE5OxrBXXMo7hmKcrp3dDMNiw9UrKvcQXFAVngq7IWa qX5dzAY3k4oMi8bYdDspq77pxpfM+1hECX22QFrOwyhZXzRiBR0X1ZwRIv4xUGNrGjD99j 8FVSFBlNffSYhVu9Wngr08mlt24obAkQE/HH1ff2sDYRIAEr0gBUW/reyU5r8lCdFnxAqe mgB1YIoaKkjeBAYDKC4ZSoLFvMxM1D4VpUHie/zwSzch0LJApvt+gaGL3s0YMBlc7FrUwn ejKC7GtD0FClSV2YKv4WVgYb1vvGcSOPFEsUZY+y15u7jvn3x3gUfEwAOemAhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6be8944d96d2cb5938b69c63b483efa616eafb56 commit 6be8944d96d2cb5938b69c63b483efa616eafb56 Author: Mark Johnston AuthorDate: 2022-01-20 20:42:46 +0000 Commit: Mark Johnston CommitDate: 2022-01-20 20:42:46 +0000 ktls: Zero out TLS_GET_RECORD control messages Otherwise we end up copying one uninitialized byte into the socket buffer. Reported by: KMSAN Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33953 --- sys/dev/cxgbe/tom/t4_tls.c | 1 + sys/kern/uipc_ktls.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c index cd2a505e8346..06a21ade04c1 100644 --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -1052,6 +1052,7 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tgr = (struct tls_get_record *) CMSG_DATA(mtod(control, struct cmsghdr *)); + memset(tgr, 0, sizeof(*tgr)); tgr->tls_type = tls_hdr_pkt->type; tgr->tls_vmajor = be16toh(tls_hdr_pkt->version) >> 8; tgr->tls_vminor = be16toh(tls_hdr_pkt->version) & 0xff; diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 5b37daf7d73b..5912db865ef6 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2066,6 +2066,7 @@ ktls_decrypt(struct socket *so) } /* Allocate the control mbuf. */ + memset(&tgr, 0, sizeof(tgr)); tgr.tls_type = record_type; tgr.tls_vmajor = hdr->tls_vmajor; tgr.tls_vminor = hdr->tls_vminor;