Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2024 20:25:07 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 85707cfdaddc - main - bhyve: avoid updating fbaddr when vm_mmap_memseg fails
Message-ID:  <202408262025.47QKP7VT080697@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=85707cfdaddc179af8bd2623091eb1b8c58fed4a

commit 85707cfdaddc179af8bd2623091eb1b8c58fed4a
Author:     Pierre Pronchery <pierre@freebsdfoundation.org>
AuthorDate: 2024-07-24 20:51:20 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
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;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408262025.47QKP7VT080697>