Date: Wed, 14 Aug 2019 23:28:43 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351059 - in stable: 11/usr.sbin/bhyve 12/usr.sbin/bhyve Message-ID: <201908142328.x7ENShUj082229@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Aug 14 23:28:43 2019 New Revision: 351059 URL: https://svnweb.freebsd.org/changeset/base/351059 Log: MFC 348694: Don't simulate PBA access if the PBA is in a separate BAR. bhyve has to virtualize the MSI-X table to trap reads and writes to that table and map those to virtual interrupts that it maps real host interrupts on to. For the pending-bit-array (PBA), bhyve passes accesses from the guest directly to the hardware. bhyve's virtualization of the MSI-X table is done by intercepting all reads and writes to the BAR holding the MSI-X table. However, if the PBA is stored in the same BAR as the MSI-X table, accesses to the PBA portion of this BAR have to be forwarded to the real BAR. However, in the case that the PBA was stored in a separate BAR and it's offset in that separate BAR overlapped with the portion of the MSI-X table BAR that the table used, the handlers for the table BAR would incorrectly think that some accesses were PBA reads and writes. This caused a crash in bhyve when it indirected a NULL pointer. Fix this case by never trying to handle PBA access if the PBA lives in a separate BAR. Modified: stable/12/usr.sbin/bhyve/pci_passthru.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/bhyve/pci_passthru.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_passthru.c Wed Aug 14 23:25:58 2019 (r351058) +++ stable/12/usr.sbin/bhyve/pci_passthru.c Wed Aug 14 23:28:43 2019 (r351059) @@ -295,7 +295,7 @@ msix_table_read(struct passthru_softc *sc, uint64_t of int index; pi = sc->psc_pi; - if (offset >= pi->pi_msix.pba_offset && + if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { switch(size) { case 1: @@ -374,7 +374,7 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct p int index; pi = sc->psc_pi; - if (offset >= pi->pi_msix.pba_offset && + if (pi->pi_msix.pba_page != NULL && offset >= pi->pi_msix.pba_offset && offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { switch(size) { case 1:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908142328.x7ENShUj082229>