From nobody Sun Sep 22 11:26:54 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 4XBP3L2rnNz5XbZb; Sun, 22 Sep 2024 11:26:54 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XBP3L1jhtz4spM; Sun, 22 Sep 2024 11:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727004414; 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=GpWPvAsZuBLHPcyux4AIlWf55n8qZn4ZFQCe52o36lE=; b=ViSqufhvyNZJs4QbiWLpxv+HaK1rXM/zLmA1BRZjZXO9E+7vXnUEJH68n5QyCJWyqwvKJv 8aFLShCQJHWJ9B7rEv8ZGdqWBrqVlWgPQK0yvfB9+XXp0RzTYnqXr6u5fBiLhKWnd1asf5 gHztvzdQNkMtqeZuRr6OeRTSzBbiq68SVxWAZD7CbbktgJWR08ww1Q4RTMRghsr2AAmbyt QCwhQgHjM80RTfuh8J7B+Yp9EyT0iOBdmJTGQsh74z0oloDHzxuMQ9LskXAtaqF63A6bzQ uUYXS5D8atWo+0SezVTfTindyjgjeIGw3us5zrXm2cRAnTP8JGh4cJd6fAEPig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727004414; a=rsa-sha256; cv=none; b=s+9tuhK0sEdHayOwwqTgUctP/FJ5O9q706PYk93uxQfD1sHtZNd0rAK6xRmrASO+keU9BY i7FCFEgo4TI23EYSHLHYgD9TEWXfm9BT1fZyv1oa7g2BGXTV1TuiiMuM0j8SJ6CEJbH2Au LcBthOyCttAbA9GdgPIdidzcCp/y3ntf5WvoxcqTiTOZ0slJAHco2SCy4hvcYdHL3HUWYp tZ7UFThui1l41qn9bV0g7gY7KKERk8182qakhLw3/pWiz8w3/R93RK2bVSO0pdyJ/wMwbf 4VE1YWFn6tRGW3zf9dzyE377QEP0y3/PJXcvUj+Um7R4rrg7PBeBPTBdiF04WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727004414; 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=GpWPvAsZuBLHPcyux4AIlWf55n8qZn4ZFQCe52o36lE=; b=hVRSi55HB95Bo+wQ7oRn2Z3aKEVEDlwxhWAliBfnUnuVhw/dhwgGeUvvH1qjVhIEG1NiA3 SvaPSSzLnivnvdBUWZSVgneb57948dhexUI/EdxDOIzWslFcaIeIkBnnjnNoSktnTZmUNb 79tW2E+4SEXCXjVNUrEYdNDJbnH4//JKggPRcwvLVSoEgbMY+zuudGVq67FNw1D65Gc1t4 gSFTM2ZYw13fG8/BK8hIegXA05eLlN93+s+TSfrDogRCBRU/x/rUyRgHbqivImUCbLQDzf YVwqqPrCdFEyVZd54jTARGu2TT1oPuyd7dMLoSDwBMZnzkUc8NfW5OA18sgP7A== 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 4XBP3L1Brzz1F6G; Sun, 22 Sep 2024 11:26:54 +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 48MBQsTw090157; Sun, 22 Sep 2024 11:26:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48MBQsjM090154; Sun, 22 Sep 2024 11:26:54 GMT (envelope-from git) Date: Sun, 22 Sep 2024 11:26:54 GMT Message-Id: <202409221126.48MBQsjM090154@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: a305f44d1404 - main - 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/main X-Git-Reftype: branch X-Git-Commit: a305f44d1404fbf386bb2b50ab7233ce9eabe0bb Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a305f44d1404fbf386bb2b50ab7233ce9eabe0bb commit a305f44d1404fbf386bb2b50ab7233ce9eabe0bb Author: Ed Maste AuthorDate: 2024-09-19 18:57:42 +0000 Commit: Ed Maste CommitDate: 2024-09-22 11:25:02 +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 Sponsored by: The Alpha-Omega Project Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46134 --- 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 8bd84a5113eb..97d6264413e0 100644 --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -788,6 +788,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++;