From nobody Tue Oct 29 18:53:38 2024 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 4XdKCl46zBz5bnQR; Tue, 29 Oct 2024 18:53:39 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XdKCl049zz45Qc; Tue, 29 Oct 2024 18:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730228019; 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=p8lPiC7U1LqU+a1ETuqEH9930Pw0VgvxqkZ8zAYjEGE=; b=EGB7/PaodnenLs0CTc0w6D2TaGVYhpLxvynF7Q8FAcpk0PKhtW0TNXOuEEgT1Tqd/QljpZ h6Tc4TSl5sO7fyAM4mqaUAa9KUwOh0NOX4NQGMJjXDIrHuLvOtxezn90jLsCpMXk4Hcbsz naI/U1cNY+jolUPE4qa3oKiZv2WTryYOpJsjBse4uUYfcaf4MqQ61/SUcA1DujCCrkmpgX cnMCloPUXv+GdMrADBnXnf38S6qVx6kboSC1TJyg62TvgIgxBjfvaxy6I5sVlAV4xq5NJW wzhfkJws9vriOZtm3m5l4D9YpLPOfHRsfgmLcwiQOKfmzcVTDNX9G9eWOD7J4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730228019; 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=p8lPiC7U1LqU+a1ETuqEH9930Pw0VgvxqkZ8zAYjEGE=; b=Nq7CYxKyOi/4keoIkT7itjcUDLFmc4BLh997NEtgd4trfEaYAYXxFc535k6/Gk3sQ98I3G hWpUlUGCbz2Km7K9nS5vf05hpa6kWPxSPRSG7CJ8a68kQ1fqvCtkeqH66i9/hWZR5SczmY rU2Sr1BTLn4ZQ5xwJjaiARfv1mGApwnbk4+629yj7xd+tTWXs+9VQSMKQvdeETyGMlwbA2 TrKIDzL7ah+Brf6uwu0ukArGq1jRgnXqbCi0AKSYb0ZgA2nVacDZGgfThjnbeeF9SzaSxD GeJRZZmKMmPnKAtsSbovrqhNlFRU7ujmg/ikKBFMaEB5ehWbfli7qS3wFr/7SQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730228019; a=rsa-sha256; cv=none; b=paCOfGQDCwPhWceb/6DnGizcxZFXMwan/dTxo+xcQiJfITH9TEqpcJz9IyzcfTI7xRelLw 2QOdKk6rYCXkWLMdHmbDiiSYQHOV1h0wmdWrPndK7IsJJK5aehI3TEXYAh71lSYFlQJRRW tU+C3jSbHsoMlmdMSdMPNvW8F1XCtO8c//uiUac9i3MSXam3TVmXqlV8UQve6ScdM8jtOU 9wSvs/5KVK/+zSohE1X6RD7Bt5s7KKDfD0FdWXQkvlbQK5Ek27SDXNdjOfLUPfpryALqfO pjXsOIn3+FFV5yhM0p9Mj1CPvCY0VIJPbN53yVegmwYWxjQ0vUfj456vR2Yxvg== 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 4XdKCk6kcGzbYh; Tue, 29 Oct 2024 18:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49TIrcf2035128; Tue, 29 Oct 2024 18:53:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49TIrcQQ035125; Tue, 29 Oct 2024 18:53:38 GMT (envelope-from git) Date: Tue, 29 Oct 2024 18:53:38 GMT Message-Id: <202410291853.49TIrcQQ035125@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: 127f37c9b32d - releng/13.3 - bhyve: validate corb->wp to avoid infinite loop 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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.3 X-Git-Reftype: branch X-Git-Commit: 127f37c9b32da806539ccab71347e2dfc30b50f2 Auto-Submitted: auto-generated The branch releng/13.3 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=127f37c9b32da806539ccab71347e2dfc30b50f2 commit 127f37c9b32da806539ccab71347e2dfc30b50f2 Author: Ed Maste AuthorDate: 2024-09-19 18:57:42 +0000 Commit: Ed Maste CommitDate: 2024-10-29 18:52:48 +0000 bhyve: validate corb->wp to avoid infinite loop Guests must set HDAC_CORBWP less than corb->size. Treat invalid values as an error rather than entering an infinite loop. Reported by: Synacktiv Reviewed by: markj Security: HYP-12 Security: FreeBSD-SA-24:17.bhyve Approved by: so Sponsored by: The Alpha-Omega Project Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46134 (cherry picked from commit a305f44d1404fbf386bb2b50ab7233ce9eabe0bb) (cherry picked from commit 6a645bb3535cb73b1f20db652c9e3893f26a986e) (cherry picked from commit 867aaad5c2bfdd8326fc805964e711ccfbb18d1e) --- usr.sbin/bhyve/pci_hda.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c index 7d824d7a1fd8..fd47abebaa42 100644 --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -787,6 +787,11 @@ hda_corb_run(struct hda_softc *sc) int err; corb->wp = hda_get_reg_by_offset(sc, HDAC_CORBWP); + if (corb->wp >= corb->size) { + DPRINTF("Invalid HDAC_CORBWP %u >= size %u", corb->wp, + corb->size); + return (-1); + } while (corb->rp != corb->wp && corb->run) { corb->rp++;