From nobody Tue Oct 29 18:45:34 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 4XdK2Q60RPz5bmwP; Tue, 29 Oct 2024 18:45:34 +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 4XdK2Q4zKHz41Q8; Tue, 29 Oct 2024 18:45:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730227534; 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=MZ0SUDTQq30xJ0ZiRrTY1BK8QXUrKnftvfSvu0XN6Uw=; b=OpCWKWF4MJ8B/G2UpoOZAK7Bc091y7Ol6bOkuDHfb2ODqqh8HqTz6sJAN2wJj1caN6QWPS evqpkY+bgR/4JUQxgRomT63DU/8T3swANJqFqWg5JiSZew7aOAeC3jQdIuVSvQTlsLi6wi pYqFqdguVZ2uKUABTLbGXksZw0Kgialul6RY37MyuiBQr+sta/w6o6+qmbSxJQboVv71jg YeTiiaMUClmpGhW2De7wonKriedywKFOpaQamFgq4iAJfgYhr6ghdt1ADRzJTn+cp19TNq GC6+sUGEFSiyK3b+nODuuPajHXf9IapGo0KXi0QTOWnqy28WnjYiDXZPp12Iew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730227534; 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=MZ0SUDTQq30xJ0ZiRrTY1BK8QXUrKnftvfSvu0XN6Uw=; b=E6UjAlNbnkp+nlL8ID48F8fES3zy4V7pp6qx9M3E+iDGCWlpHx5yH2o5DOlXCQsS/M1gSg 1bWqbYc1s1AM7bEgCsAIzAhSQaAyDJdamqeVSdoGKJ0R66v1SrWvFWWCez1bWzKTlwrove VtMYdAtXZG8dX9Eg4slf7Xt1drt9FukFgd3Vpa8/D8W9f8/jmHVDycpMgmfZk6fokt0VUg Q30/kKeccC8GtiDl55Wf32kx2qMkZVQsz82ghKzPVpEmHNjzTm9ASmfa5Y5cTuCYUOi/yy N3nk0VF5ZKuj5y4IFiD9o3SWTmjnAhyMiAnGnfpzD6WA2OfAFil87IaRtvQE9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730227534; a=rsa-sha256; cv=none; b=oXd81HGZBdZfHYfSDoK0/NEtkFALS72sLf4TOwR5qH5wI+ndMrH2Uo8aMSK+FizCa0VjAv v5TOCOaO+ThD/4OSaQZfGiz720MuauO9q/t+5Fb7M2mivLsYmx/LGFZ9DC8haHchHh+PBU nm5IXAkCPJeEs8wut6loN5yLDOQ0mp631ET53NcR3nrZaJTK5uyXYKmJ0NVGZ0eXV+bzkA K2x4jdnwCznGOBgCG9Al84TA7jKe0buSsO6LOeMfFgPP/SPvQFo/g7mhBt0AQhiRCksvMK 28HpGiAgh2cElHU0kPME2cIK4S50DszeczSbz0pKf0uKlVWE14so+pRnKIopJA== 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 4XdK2Q4ZvZzb7C; Tue, 29 Oct 2024 18:45:34 +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 49TIjYKo016965; Tue, 29 Oct 2024 18:45:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49TIjYaQ016962; Tue, 29 Oct 2024 18:45:34 GMT (envelope-from git) Date: Tue, 29 Oct 2024 18:45:34 GMT Message-Id: <202410291845.49TIjYaQ016962@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: 6acac2ca9aa1 - releng/14.1 - 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/14.1 X-Git-Reftype: branch X-Git-Commit: 6acac2ca9aa19cb20426c1a8bbb02df30e5ddb5c Auto-Submitted: auto-generated The branch releng/14.1 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6acac2ca9aa19cb20426c1a8bbb02df30e5ddb5c commit 6acac2ca9aa19cb20426c1a8bbb02df30e5ddb5c Author: Ed Maste AuthorDate: 2024-09-19 18:57:42 +0000 Commit: Ed Maste CommitDate: 2024-10-29 18:43:34 +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) --- 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 6f0c1b6cfba9..58481af71a4c 100644 --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -789,6 +789,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++;