From nobody Wed Apr 06 14:20:11 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 8961A1A91EA7; Wed, 6 Apr 2022 14:20:11 +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 4KYRVg3PW8z3M6V; Wed, 6 Apr 2022 14:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649254811; 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=OZ3c0Q4iFA3hOp8LeJoGljd0kQEYZJ4fW1/qm2WROHk=; b=KETeHZhMQwu+QJGvGfklogwwtgQhVBusY/WTy+FWxFTw2KTtCoaF/xpjlss8JKsckHxLAb B0H1p1vY1YYjJ4CWfqEXv5FyPLOs6R0FZ5VudwntXOBO3PzNMuzoCLqlPYeHJ2l4S1WYtX ub9o+iwLRsvCQ8Hb3T/RXS01eCtXqSB7xCGFaDPErDcQKzUWvx86uK7NnWq6wOft2whrZ0 eq5ysCEnZBKSpe7ctuQ8Bl13jjqg369UdqGF+Uzr8xZAxN8TwGZK9pPIXPy8DEdAy0la8m /hPRQs/t4/RS4GrJJQNrnbo6Zu/+ze6FDB0XOYpjl7S3rWRzmaoDCQFTA41njg== 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 508AB1C7F6; Wed, 6 Apr 2022 14:20:11 +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 236EKBRY043073; Wed, 6 Apr 2022 14:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236EKB55043068; Wed, 6 Apr 2022 14:20:11 GMT (envelope-from git) Date: Wed, 6 Apr 2022 14:20:11 GMT Message-Id: <202204061420.236EKB55043068@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: 9b3cf23b7d11 - stable/11 - 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/stable/11 X-Git-Reftype: branch X-Git-Commit: 9b3cf23b7d11b3688bb564adf937ec4e0530ba0e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649254811; 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=OZ3c0Q4iFA3hOp8LeJoGljd0kQEYZJ4fW1/qm2WROHk=; b=qTTfIoQu+ODq14DyJ+j70KLe5OIK5et4wVf4nqlzD/UIBIK/I70Z/0x2toJ8ovSysyoaCm +qHjIiiX914h/AmzKy+wMVp3QKIn+86GGm/o7dkcy2xl0E5DT2MHlVu8jwKfYUfbPjksZj D9dnILMNioF9S8t6n6aDw/e3xE1f+lENZoatUSskzgW32rDczIvuUvvtWtUGxiLiRgvxmK K9W5e8+uA+/sBkvSYgoyGNGjLynGG64p18W+BMVS77HSFn9gmQHaf1BHffPsEU/+tPfnEe YLnnOsQJGVKd6Bp7QvO4KhW2jX353fbYC6BrzUV8XWYpoiB1WiOBnPr3ws2iIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649254811; a=rsa-sha256; cv=none; b=bnSb+bg9amWVcj1vuBkM1lL+FA0WdGNeahhyQpg7/4K+w0Yj/guzoDi3ILQAyTZev4VRnu KBEJSC2nhVTrR4QVpCWu9wiZEqo/qOLryq2rQwrPmW08pN2JMoWZcJqMMuSRk6kfKrib9g 0gE5F7Vej305G9Xi7x/FAyN2bHAQWC1HglAax/qc1Xtsys/FQz1UaKVVTfRcPz0miQHIaf tV0xNm29JJdI1x/O6m2+ars0Rb9BGy3zmvZiB6v0P4hROYjfsaZxjhtnbkIl2yOns+HRv2 fI6qb1WhCc03DH41Jnq+f1JUwU5YO2L2le1ORq4bnM2VwQqyUVlGbAY2equ15g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9b3cf23b7d11b3688bb564adf937ec4e0530ba0e commit 9b3cf23b7d11b3688bb564adf937ec4e0530ba0e Author: Mark Johnston AuthorDate: 2022-04-05 22:52:18 +0000 Commit: Ed Maste CommitDate: 2022-04-06 14:19:27 +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 629df7c108abe26496c3a5c196cce79a47bc1f21) --- 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 988b3810368a..0824327df9c6 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1273,9 +1273,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\r\n", hdrlen); goto done; @@ -1287,6 +1285,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\r\n", hdrlen); + goto done; + } } /* Allocate, fill and prepend writable header vector. */