From nobody Mon Aug 26 20:25:07 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 4Wt2Gq4wP0z5TYqd; Mon, 26 Aug 2024 20:25:07 +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 4Wt2Gq4R6zz4PNm; Mon, 26 Aug 2024 20:25:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724703907; 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=+U5n/IvawVB/0wb2hUhn91zxZuS/tq30prxJokcJOeA=; b=szt1f/RsAYcaMqW81S7XXZU/W8sudpGbHFhxw2qhv6UL+Gaj1HnEIiLB2/GFoOwenXYqHT d6yb/8WG8LnbqU7QbZcQEpiv0NeixxqSKCtgC63cN0QasT8zXoqUn6Hl6LhRCKL45QJW8U cFOs2k7c4ojkVeEzAReaRiy8le7PfQId1pCJhkajtkB5XyEeClwRKob5Ry3J8d++Q2WA3z L85wXlTrK3n7gNw2yrlP/2uyEAS+ETZxMRAZZrqX02QhMMPeFReYmO0i/8eHc33wrxNuHx t6E7DyjY7JLH7WKlQdX3+HRBPpIo+pd5nPrcKdNJ8ldqhTUa/1cjshyvEMsgxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724703907; a=rsa-sha256; cv=none; b=H1wJPJuqhPWDzZU3+JAc41GLfDUKGc37Bbc5QXqRiLkO/TUW14eupUVP/k6qN/pdpygeb9 Hy2lOiWBhdUKEhqLBeZNTY8SVTp6p42zLhgDeODGFk9y0bFcnzJ398kifG8NJU5MpI8mBk yAVw309Wlca8zlnEn1BlJSVLtCKT0YOlTK2nf3ybUlIgzLkYCqIa2K745LyyPSmjkIUSBk MebtCl3jlqmcYxQOe5Y1qvjQwaQJ7/WUcO/pilanF1uXYiHvTfik8xSmiE7zuxJcIsnUeH +lAfJModajXo2igr2VCa+YSo9Cp95f12KXbJ8gNJ3WiTHLet6OghEfhYW2ZgKA== 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=1724703907; 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=+U5n/IvawVB/0wb2hUhn91zxZuS/tq30prxJokcJOeA=; b=SBnGKZPZGAPHPbHoXZwWwb+UKUB0S+vZq+5WWLTGuqVuKGDbxqIvDiBamJhW54iYyo41Yi /7TTGMSwWXmm2aUbo2FZt7t1+WtdRfXjGWN1M3bcSAPRbpMu/2lPC+VZ+gtAFn+5Pw2wsr jvs3f/QzBZco5TlZ5H4Xccuqrev0hDulig6uwdspVi7ASyIV0KId+Llual0LPIvkr65XXg CZP8i3ChA+IpSC+EfJxVjJlasTwTdI2pRMXQU8v21SPhHxhaHV9mqAVh/dBmPN+4B08rtC 3EqKgYRdm2ws9vdlNH8bpNsTdOkhBGlgrkMMtC6CtNM4O3AYMU4y5Qb0ukqyZA== 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 4Wt2Gq42fmzL5B; Mon, 26 Aug 2024 20:25:07 +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 47QKP75t080700; Mon, 26 Aug 2024 20:25:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47QKP7VT080697; Mon, 26 Aug 2024 20:25:07 GMT (envelope-from git) Date: Mon, 26 Aug 2024 20:25:07 GMT Message-Id: <202408262025.47QKP7VT080697@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: 85707cfdaddc - main - bhyve: avoid updating fbaddr when vm_mmap_memseg fails 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: 85707cfdaddc179af8bd2623091eb1b8c58fed4a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=85707cfdaddc179af8bd2623091eb1b8c58fed4a commit 85707cfdaddc179af8bd2623091eb1b8c58fed4a Author: Pierre Pronchery AuthorDate: 2024-07-24 20:51:20 +0000 Commit: Ed Maste CommitDate: 2024-08-26 20:23:52 +0000 bhyve: avoid updating fbaddr when vm_mmap_memseg fails In the function pci_fbuf_baraddr the field sc->fbaddr was set with a user-controlled value, even though the call to vm_mmap_memseg failed. No security risk as currently sc->fbaddr is not really used in the source code. Reported by: Synacktiv Reviewed by: emaste Sponsored by: Alpha-Omega Project Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D46109 --- usr.sbin/bhyve/pci_fbuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 798e9b41f0b0..125428e0b772 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -231,7 +231,8 @@ pci_fbuf_baraddr(struct pci_devinst *pi, int baridx, int enabled, if (vm_mmap_memseg(pi->pi_vmctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) EPRINTLN("pci_fbuf: mmap_memseg failed"); - sc->fbaddr = address; + else + sc->fbaddr = address; } }