From nobody Tue Jul 19 14:09:29 2022 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 4LnLLK2PSsz4XP5s; Tue, 19 Jul 2022 14:09:29 +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 4LnLLK1x1dz3ZD6; Tue, 19 Jul 2022 14:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658239769; 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=/ba3lQ+p5dAYkFbowA8mlZyM/lRcp4xPtmBn6pja3Vo=; b=t3vs7qH/VtK5y10nWqKXSzfTHX8P+5//QCXiuz/8eMoR/vGKJaXz185klIcolCAOG4w1qt /M1EZpsW8PZqSiJ4sU8zCyvhZPmaEKY3XESfA0SsfWAI9LBAZEV8/Vd5pqRTsXH8wcR7dL uuMOLoz5tEVdbfGop7Pt5ecJHyLXTVgoZ7nxgzu0caw1ucKcS4BX+sAsTCNa+wdzPAjLJn dM1mH2rkZAZiZ0HosWaMEp9Luo6XuIZ2yUdmn4s0RTmHTpAu8podQScOhUUA81K0e1Keql FCgPVnr6g86FyM6aHo7MSO+z4YFKDoOawdX4Whree+kMIMoN6MpvN7U7sijWuA== 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 4LnLLK12mLzLlL; Tue, 19 Jul 2022 14:09:29 +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 26JE9Tpm052038; Tue, 19 Jul 2022 14:09:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26JE9TlI052037; Tue, 19 Jul 2022 14:09:29 GMT (envelope-from git) Date: Tue, 19 Jul 2022 14:09:29 GMT Message-Id: <202207191409.26JE9TlI052037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b7806e7bae20 - stable/13 - ktls: Zero out TLS_GET_RECORD control messages 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b7806e7bae20553d479bc96fdfe7ae735072b9bd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658239769; 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=/ba3lQ+p5dAYkFbowA8mlZyM/lRcp4xPtmBn6pja3Vo=; b=tHfp0c2ZcNZN8pw/S4y0NpMl63Qc1Zlh/oQcmqGgLDc5yBX+jPX890AoeFO9tqprzKNID1 yrDhO6ekoF3pOq932NSRM9BhabiUEQ0tVnB6aFV5dCa60V1t382a7nz2P9vY+BML8l8twH 47LCxOOP7KZT2bpeh0dJ9uiNlWm+/nE8PWp63nohtqOGjGMCi+S1wszDbSdYPI5V3L2kFM T6+smEszDIJy0++Khcl0UDgxFUUAtWc6jF81U48QkXbS5XO/YV304NKWLuKbDfEvRtDF0J 7FB4OcwhBN++THvVyGi1tXgvdExCeFQ4qMtJgILBgxX3e4sGtaPWafBpb62ALA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658239769; a=rsa-sha256; cv=none; b=NjkLAIAcejpm3I81HDwE+WmYGoTs4FLo1VHGoWtO9A5+OgSvN3Rf68T4aIZHCOGnUoRNXH fslxq8urpYG9eC6ZaA1xjl/3NInnE+4TJGuNk40oMf854aXg9sc5arnTgHMM+FihK4wsRN UTPE2enRPEPa622bxK6NmfBShZPvoBWUGMJymiQ0NbLqoIOkOFtR232s65l2LzSCpcQryY 2h4wUIx1lMIgUAMdSpBfq4pREol7qYFTl14URwXKDn39rmZRpjKjdfLLBqHSYIACCucOt1 6/6ZDQFRa4S+vTnZt1mjNXVKhWeOrThvNxQIFIJMJmkxpb3PlhAhnuLOk9qTNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b7806e7bae20553d479bc96fdfe7ae735072b9bd commit b7806e7bae20553d479bc96fdfe7ae735072b9bd Author: Mark Johnston AuthorDate: 2022-01-20 20:42:46 +0000 Commit: Mark Johnston CommitDate: 2022-07-19 13:53:41 +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 Sponsored by: The FreeBSD Foundation (cherry picked from commit 6be8944d96d2cb5938b69c63b483efa616eafb56) --- 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 fdd6d43c796b..97bf3a016fb2 100644 --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -2157,6 +2157,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 f6190e24a6b2..f60d5e0948d0 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1986,6 +1986,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;