From nobody Tue Sep 24 22:53:13 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 4XCwBK4yghz5WC4d; Tue, 24 Sep 2024 22:53:13 +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 4XCwBK4Nzgz4GW3; Tue, 24 Sep 2024 22:53:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727218393; 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=jZLXrUi/dOIWic/x0lsSTQeuOTI88MD1gWnK3s0uG7I=; b=bQFGdVrrfPN5ICgTG4JNz1oMLTZzccUJE7cGaj69KQErxIXbw5oa142dbNNv43+4Qn7Wmr ZFxpkRktW6e7R21cZQCNluYTSpPGvPFaKkdzbM1B5V0OtDveaVygQwjU8r1KOCO8exLFhP vn9rxWrk+yQvrY0Utf7BM+OeuXRk/QK6fDTFoT/CMky3tov7eFi8fkjHa+Qmw7+R6k5YB5 DF32oD8jBoTqvmE3qO9ourMpbF1L566SVFLnXpb+Qr5bqRu3aKOLx15sOy35UJI+4S9uOP Fzn0sOOxT6KVMdTG7QFO3SO0E1wxBvp7P6DuwuA1a7cSWM2dYp12F9jHfJe0LA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727218393; a=rsa-sha256; cv=none; b=Py62jUzJAV2fCUQYZwz/rYtux6b3LUMA5FWBVTTq3uAzjg4KM3aiO+JNS+NWu303CLO76m CWzEbLiwZ7hjU4bowKr1Uwdioxkv9vzY1j3XFjabNDLcf055uHzTnFD0kX7cDdYnoOmP3T oViiMk/jM+i54Fc2YRqXkSg7Nbd93KiOh2b5DEk5u+L+GL01V/Wg8gmHPCeN/XWBPpZqvr tXZDPyN8nVUtoJ9pe801pokH9TjZX7sghka5img/PR9+XWy7SRIa7Qd1tMn9dS+HoidULE lKB1OIX7Z9h9rczKSmPopxCHgjjLFN/xWAq3S8uXR+ckUzTMZrtGoqRboYV7Kg== 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=1727218393; 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=jZLXrUi/dOIWic/x0lsSTQeuOTI88MD1gWnK3s0uG7I=; b=uTK7cSwhyFSB8MU6p1QSGbTWg9M1qN5ogCJw3PpwpIBjlTvbTNCieot2D8ZEK5GBDHVYZ2 pNvihVFLD5TVn/KCc09bC5/fymY7M4lpdxxXk5fDvGlQJ7izpGmG4Xb1ADIIAFamtc5Qnt 0YCN0rXf8CWoyakOMIQsnLwq63EfYVWVCHhE6OnJBKmETSNR3e97lavW4ShYBeKRowLM2V mDxA849Gp+mVtD5TZYhYXFKRoLl8DexkmYldTZzRznQuEYZ3iIWVo8dg8yO8ic2pH4Pmrs sql0Uf2oyZgRSI1qt1ui4sVQn+fTBhxqqfDEBh7tffZw2eekU4/pJIKolpQd5A== 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 4XCwBK40DJznXF; Tue, 24 Sep 2024 22:53:13 +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 48OMrD4c072485; Tue, 24 Sep 2024 22:53:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48OMrDh7072482; Tue, 24 Sep 2024 22:53:13 GMT (envelope-from git) Date: Tue, 24 Sep 2024 22:53:13 GMT Message-Id: <202409242253.48OMrDh7072482@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: 867aaad5c2bf - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 867aaad5c2bfdd8326fc805964e711ccfbb18d1e Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=867aaad5c2bfdd8326fc805964e711ccfbb18d1e commit 867aaad5c2bfdd8326fc805964e711ccfbb18d1e Author: Ed Maste AuthorDate: 2024-09-19 18:57:42 +0000 Commit: Ed Maste CommitDate: 2024-09-24 17:31:09 +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 (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 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++;