From nobody Tue Apr 05 22:58:40 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 E25571A92142; Tue, 5 Apr 2022 22:58:40 +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 4KY33N62S0z3Jt5; Tue, 5 Apr 2022 22:58:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649199520; 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=YvyIE8pOUXhh1/YhiPViNPUx1THA8A73+BHFKL8Rj5A=; b=Wd5oN9PbwMG/T+5ap3tYWRl8NBJkZJbYOuQ0S9idbl0r9Ny7DlyhxdhAKIWEa0EU1yIUSs lZMwcbR3576EvWT5fr5JjNWFNdI52rFYfYAEr+gaQvTDgcfHV+Xc3y4H5OLQd1hJhJJIEK 6CyPQNM3N3huyrlA70KIqsqlitmovQCpjObXrUc0AFcKVkNlLmm5Yl23Acqar3fU5FWXgH bYA/os2zBsbxoOxzLOhDbJLi4tYvcAx2rzgtwKYiWiDFYdDISe6TdqIUycbpMjz/I/LH8i Fj+iVen1Hv8BTiEfG5v9r/i2Q50KxfkndGxmGRelucTpNb2kK4+IfxQpzCI3og== 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 ABFA47835; Tue, 5 Apr 2022 22:58:40 +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 235MweeG096385; Tue, 5 Apr 2022 22:58:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 235MweSN096384; Tue, 5 Apr 2022 22:58:40 GMT (envelope-from git) Date: Tue, 5 Apr 2022 22:58:40 GMT Message-Id: <202204052258.235MweSN096384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b0aa20bec5db - main - bhyve: validate e82545 checksum offset field 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0aa20bec5db244980a0248e24dd6b8e1e68c4d0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649199520; 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=YvyIE8pOUXhh1/YhiPViNPUx1THA8A73+BHFKL8Rj5A=; b=RktvK5x7KVhvbEiDlOPL+D8vMSSX5mdj6IvrZyhqzqNchERI3eU8JW6cqzUcS4PMYTrNw9 Y548aGPEd8x+ROwR6Ay/I1KgeAyC1oGd/23IHC43gvsGg6gHMu1Gw/TCEwzz0gyFql39jq VDFPydpPhMGYSQfY2PTY+QOFhLUKAS7Hx2I1/GBBROIeWmi8S7Wit/1TWT+18xzRDf2bD1 T8FRgT/sAebNxJvlIlorZrEk3pt5y86sQ1Vw9sKr0d5eKBwN6W8abKx7277YN2l8qntOHg u1nOrr6XX+HU3uV5Qe7IFtYNfd3w05YKCPQbOOGZ6kzDCfzZVtNL8o66t9ENYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649199520; a=rsa-sha256; cv=none; b=u5j4aSMqRnab1grr6FydiRFXe3kV71kKAvZuUd+CQSia3Jtf3WE69lwXVzA+EPFeV3W6Qo GTT9judkNTouVotvPOtwrGSTj+b3NYKcj8ufdQBZPaM+HKMZCxV09m/YHcIdcBWk9yWFB1 /iJ0Hj2Jquax4bDCNaF5cmfd1dSyXEVKoHeUMdO+82ldFuxc+9Y66qSVTZQ5dp5BegmrxH RBddTbd8w0HFR0Im34LH6Tu2F3d6PnN7J+P/i//bszxiMFhG4oSlaf2rxeTBA2hfZkQLy4 e214+HMMg0MbgyafayOvES6sckzgEq92vZDCR31jIJIGzIS9ASshrUWcZC3nFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b0aa20bec5db244980a0248e24dd6b8e1e68c4d0 commit b0aa20bec5db244980a0248e24dd6b8e1e68c4d0 Author: Mark Johnston AuthorDate: 2022-04-05 22:58:28 +0000 Commit: Ed Maste CommitDate: 2022-04-05 22:58:28 +0000 bhyve: validate e82545 checksum offset field Reported by: Mehdi Talbi, Synacktiv --- 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 85c02889ad51..1df2f31be200 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1276,9 +1276,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; @@ -1290,6 +1288,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. */