From nobody Tue Sep 03 14:55:08 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 4WypZN6nwWz5TN7B; Tue, 03 Sep 2024 14:55:08 +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 4WypZN4V34z4x95; Tue, 3 Sep 2024 14:55:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725375308; 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=cxu314/U+lT8zfRQYMMz+Akl5+eMBR0SF+WWHg2ex4Q=; b=oktI83/k0PQ6gbrYNRYdfKpx3jhx0vFjWZ6qRqjrQymldQTNSE7QwMxQgabmBFmaAuUqFK do+V2RFnz70/w0nPv86Cy8xRXcNMqoWaDoMJCVEY00fA/5+5CtS8zvejBm2Xg7NyceiBpj tKHsVzEjOVlrC2KWnmmiPM+VLBAMF5R3xYQwZbkktL3WDD9Mh73k17FKYID477yD9qFn+I HvQYfi+7cYDFBAdebwJhragfkYvqRR/kMXJr/T2NWYgPRl6EnLJdd6m87Mi0IQ1PIx+n5b hyz7P5AQ9GzElVuDMyMipEnEjD5XOqudilALyG10dzpJYas3MHsMUdFa19Bdtg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725375308; a=rsa-sha256; cv=none; b=o4UU8PoiY75HBsH7O9zZUx55B9EXcXNeN0/znzqg6S/yEyQB4UKTYpJV33s49ZK3ZGIIFq 4KeHY2YDC2vbC/tCL5weS7etL7KZ9vhRYjV0tjXoMqzACva549FUUSNXwnRDxVp/tQz4xg RuBRQ1VBJaBj6Cmsv12cSXhxzvw2ZrgbIJfbBv3qBZArKSUF6jvQRJh9IlSLioJ5p0NydF CRHC3xia3lrEAGcdlTRV/U64izfb3KsvdCLUg8EP+OHs2/opYCBvsu9mvpkahOajJTvEex nDzEdj5+N1CygD4kFVcsP8qc8uVTsW5+ABCbuvfjF3Zb8kHbRuzn+H2EPJ9AFA== 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=1725375308; 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=cxu314/U+lT8zfRQYMMz+Akl5+eMBR0SF+WWHg2ex4Q=; b=ydtjT+WKb4XU+YFNy0Jy+BneAyUquGHgvDHiC2Ze0tfQXtoDpl3MVj2o0sI3Gq8GYWSkRo SqnInte6xRy4n/xe0iqJV0PFBbi7hsDSdtCP/r4mvl+Rjz1D4nFliG6v3ra2GaZsKNh8Os vvQEjAjyhwjNqnd0EKB9ZgK63WS5Mv1Siz+sywg3msFdgPyIyF6OxOKpRL8ms0U/EhWPCE U+srDcwgNy3zR0A4NkUEeVWy5GLFKkG4Z35NGVzEBGhie54BFy90Ny4zsitkJwwM06mf1a VxQtFyk34Jwy/uB3BD8wdsijHIAjwjTnGSfjjF0AvlKrI98wNnCWFoVYgY+oow== 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 4WypZN3YS6zlrC; Tue, 3 Sep 2024 14:55:08 +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 483Et8Xb070968; Tue, 3 Sep 2024 14:55:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 483Et8ng070965; Tue, 3 Sep 2024 14:55:08 GMT (envelope-from git) Date: Tue, 3 Sep 2024 14:55:08 GMT Message-Id: <202409031455.483Et8ng070965@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: 10f7e124eadf - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 10f7e124eadf4a3423f0a3859fc6946017b2229b Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=10f7e124eadf4a3423f0a3859fc6946017b2229b commit 10f7e124eadf4a3423f0a3859fc6946017b2229b Author: Pierre Pronchery AuthorDate: 2024-07-24 20:51:20 +0000 Commit: Ed Maste CommitDate: 2024-09-03 14:54:45 +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 (cherry picked from commit 85707cfdaddc179af8bd2623091eb1b8c58fed4a) (cherry picked from commit 4a81e501337cf160d56af2d638f080983e520654) --- 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 32ccdabec8b5..61dd8133f8c0 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; } }