From nobody Wed Apr 6 03:04:47 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 6B5061A851C1; Wed, 6 Apr 2022 03:04:49 +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 4KY8WN42djz4f0n; Wed, 6 Apr 2022 03:04:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649214288; 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=ZmbXNMDz60Ymqg05t1HsfhOWX0dsYFwHRPVeWHMlrMI=; b=pWrMhkiVN0TH+22D2dsjJ9kWkHa1aLa7W4EtwabVlQn7WZS49HzibjN011N5qAybFbfexb ESAMvmicOPiIouJfknBocnG3f3bWN8rRly1iPyze07f3YKhGWS/pc7ICXiQR3aJDcIml/V murEDllQR4t5a1rVSNRVI72VgWGy+D/UBDrykxVchb8/llYCmUQWx2okZb8yhNNBiA+Y1A ytujJJIJrZHWuXaETR0vaFMYFA8PoZ+wBhgEvRANw7Dg4Zn3R9cMzpKAz851bgdCAMi2lv 8nHU4xFZiVh3Rt4+YhmZO5WE3s4LJGeEVt5fD0SxdKAWDWZEVCbJ8+cEcf4IXA== 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 1DB3213452; Wed, 6 Apr 2022 03:04:48 +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 23634l4I035154; Wed, 6 Apr 2022 03:04:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23634l3B035153; Wed, 6 Apr 2022 03:04:47 GMT (envelope-from git) Date: Wed, 6 Apr 2022 03:04:47 GMT Message-Id: <202204060304.23634l3B035153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 9c55c1cf567c - releng/12.3 - bhyve: validate e82545 checksum offset field 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 9c55c1cf567c598b0bbb2e996d09ca0b44ba88f5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649214288; 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=ZmbXNMDz60Ymqg05t1HsfhOWX0dsYFwHRPVeWHMlrMI=; b=p/+QLIthPCJwJz8pkKm8hEnxvSTtpMGLLh9rrqdKN/6sNN0N5D6N+snlWrpyB0xenQkbzg 6vZi7YIe5aMFIr32rwW7AOgHIrwKSP/E7hQ+NA9w/y05ABYYfNbTDQe3pFxi6GrXac6keg 2a9WB4rw2kb58a9IVK1snH+Fyrtp48XlJ1xWY4IcQ4aab55nSAxhnE1QGl2ivHnQrIjYkL SPLfJf8lSlUSwBiHxEBPK7/gWwyLY/uhLLH0rYw5QVsUO4kNe7Ozyr3TW/J7senlfmDxpq GbpNoy76VSOX8rsetafdqXAtPgTVNRoFxsP4AZZX0Aa54FyuIw3+AtGWxgoWvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649214288; a=rsa-sha256; cv=none; b=BzkE7SWGGlDN2dd0ECbxBj9ddPF3QqLo61KxPlbKn0Bqb8y0/1KrlEXEIDFdC9lu6+f1Fj 6eJETLsBxms0bRibkH+F+D4dIKsgckFfkB9CdOYom0wbRhN3w3vdlKiwtMZs6jCObiNHBb Mffi7njBSdiUZCnW8gs6TUzPHMCJcvvMDV/506OYjYZK+uvzofcU8RaUNJEFSdVJnTaDE6 7JTUtr0QvMkGMRzmQHK7KEhCyQJ357LILaDTus3J3m1b+PYQCQ7GRd2ippdow7JnhNmI6Z EAnjUwwzFPKRsAjEgqt/PDxHzFix0VBl5oXRwD1Hqg61EwewkuqLdRV+Ajg5mA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9c55c1cf567c598b0bbb2e996d09ca0b44ba88f5 commit 9c55c1cf567c598b0bbb2e996d09ca0b44ba88f5 Author: Mark Johnston AuthorDate: 2022-04-05 23:20:50 +0000 Commit: Ed Maste CommitDate: 2022-04-05 23:28:58 +0000 bhyve: validate e82545 checksum offset field Reported by: Mehdi Talbi, Synacktiv (cherry picked from commit b0aa20bec5db244980a0248e24dd6b8e1e68c4d0) (cherry picked from commit 53f72209479885dfa6a7e6ed68cbc82c68464f4b) (cherry picked from commit 1da62e16e4a2270c85db1f507cc3025c5e0d9fdd) Approved by: so Security: CVE-2022-23087 Security: FreeBSD-SA-22:05.bhyve --- usr.sbin/bhyve/pci_e82545.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c index c6ca5882a535..2a1e54d89c59 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1275,9 +1275,7 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, goto done; } if (sc->esc_txctx.cmd_and_length & E1000_TXD_CMD_TCP) { - if (hdrlen < ckinfo[1].ck_start + 14 || - (ckinfo[1].ck_valid && - hdrlen < ckinfo[1].ck_off + 2)) { + if (hdrlen < ckinfo[1].ck_start + 14) { WPRINTF("TSO hdrlen too small for TCP fields " "(%d) -- dropped", hdrlen); goto done; @@ -1289,6 +1287,11 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, goto done; } } + if (ckinfo[1].ck_valid && hdrlen < ckinfo[1].ck_off + 2) { + WPRINTF("TSO hdrlen too small for TCP/UDP fields " + "(%d) -- dropped", hdrlen); + goto done; + } } /* Allocate, fill and prepend writable header vector. */