From nobody Wed Apr 06 01:56:57 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 39B681A96EA6; Wed, 6 Apr 2022 01:56:58 +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 4KY7156zKJz4T0N; Wed, 6 Apr 2022 01:56:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649210218; 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=NEwk/M2eozLPm0DvAfvUx/AGk61faXThgtFZ8IkYCNc=; b=SCeh4y11IBDQrpzlIDKKYjsCEbe0UFVbk9jATBn0VjHilkMcbBUxC7lLkrLAtL8uWs7qy6 mh6O14QAsc+j2lsbyySByif+zhKryQLWRzaPLzs7rbe36LE3XlHQmaRQJ7olZI6tGOnGzZ 94tI59/AiGMJHz73GXcdXOoMVjdP5I0DGt9Vfa/Lp7TRqzNPAxIFwULgAYKSVMsuItEkt4 dqny1zge44D45lhEe6jTPkgDT9JeIeXojysNE9kGN5Ssxqg6ZwRywZyTpp//qG4CyLnUPe ThCyaINYHW4jP/LWPGLNa/EGxiQ4iUrFqAVDE8nx+xBFz1mku0TuM1kUOA6ewg== 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 B38C711F49; Wed, 6 Apr 2022 01:56:57 +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 2361uvaG038675; Wed, 6 Apr 2022 01:56:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2361uvr5038674; Wed, 6 Apr 2022 01:56:57 GMT (envelope-from git) Date: Wed, 6 Apr 2022 01:56:57 GMT Message-Id: <202204060156.2361uvr5038674@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: 5a28d8befda0 - releng/13.1 - 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 5a28d8befda032e52bf8ad160992e3499f5bbdff Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649210218; 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=NEwk/M2eozLPm0DvAfvUx/AGk61faXThgtFZ8IkYCNc=; b=Kkw1tdDn/dyEvd0aY9JZ5PJ0ErmloMUvtMswsPywE1ViSwK/U8q0E4wJa2Ss++IXaPKbIH 74OvNgpmxtz/+ozBhRSrrQ4YRL0HjWpvkrd1Q01itaU8yp4TV9Z1f8+ntdL28TybHf700Q o01Sp20e47UNCvIPl2uNdcyU2z4kkWs5ZgP/gLr+I4s+7pH0PInzmdzE167dcdDM1tXWgb 1KZI7BB+RFX5A4c1seGk7PxRpqhVs7cUoUrAwLCdXyOgw67EjJdtMeVX51JYtYoI8KV1Pe WpSC2FhVhoLMlLB/UY82tbCWcb8kqz/GBn4hyVn5RRAvZG5TcawjS0zyKw/+rA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649210218; a=rsa-sha256; cv=none; b=qm+exLZxHIdHtIqxeDJcuaIHQ3gxdNILBdoKgesRke84DZbFHbHVsKD5jK3t79b8y7Mr89 kMJmXRAJpTlQBF6nmhefEmyDKVeuli8ZfZjlwI2j5CzTqosPSrmPNYVhiunapLm6klGp2z NY8L+IlQB7OA6YSp8aDVGnRSyv9l7KXS1TCLUPU3ECTuTn3lQS+EdnsY9hTs9nS4zNVDSc L7NedpSTBbscuZksWGvNRhbD1MJnoKXcMocgrtPOXrlut8xcOYAgzMi789AMa5O/5DgGGa 9LNqBRDX3I4sPdqdw1eIyQ4OYGlIBe+WDJYUnkhod8281LbR33AfuUSaNmiLpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5a28d8befda032e52bf8ad160992e3499f5bbdff commit 5a28d8befda032e52bf8ad160992e3499f5bbdff Author: Mark Johnston AuthorDate: 2022-04-05 22:51:19 +0000 Commit: Ed Maste CommitDate: 2022-04-06 01:56:21 +0000 bhyve: validate e82545 checksum offset field Reported by: Mehdi Talbi, Synacktiv (cherry picked from commit b0aa20bec5db244980a0248e24dd6b8e1e68c4d0) (cherry picked from commit 53f72209479885dfa6a7e6ed68cbc82c68464f4b) Approved by: so, re (implicit) --- 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 d0b4fb9e466f..76f2839fba31 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1278,9 +1278,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; @@ -1292,6 +1290,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. */