Date: Fri, 23 Oct 2020 10:48:14 +0000 (UTC) From: Ryan Moeller <freqlabs@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: r366965 - stable/12/usr.sbin/bhyve Message-ID: <202010231048.09NAmEW8090391@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: freqlabs Date: Fri Oct 23 10:48:14 2020 New Revision: 366965 URL: https://svnweb.freebsd.org/changeset/base/366965 Log: MFC r366771: bhyve: Update TX descriptor base address and host mapping on change bhyve sometimes segfaults when using an e1000 NIC with a Windows guest. We are only updating our tdba and cached host mapping when the low address register is written and when tx is set enabled, but not when the high address or length registers are written. It is observed that Windows 10 is occasionally enabling tx first then writing the registers in the order low, high, len. This leaves us with a bogus base address and mapping, which causes a segfault later when we try to copy from a descriptor that has unpredictable garbage in a pointer. Updating the address and mapping when any of those registers change seems to fix that particular issue. Reviewed by: mav, grehan (bhyve) Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26798 Modified: stable/12/usr.sbin/bhyve/pci_e82545.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_e82545.c Fri Oct 23 10:24:37 2020 (r366964) +++ stable/12/usr.sbin/bhyve/pci_e82545.c Fri Oct 23 10:48:14 2020 (r366965) @@ -1699,18 +1699,18 @@ e82545_write_register(struct e82545_softc *sc, uint32_ break; case E1000_TDBAL(0): sc->esc_TDBAL = value & ~0xF; - if (sc->esc_tx_enabled) { - /* Apparently legal */ + if (sc->esc_tx_enabled) e82545_tx_update_tdba(sc); - } break; case E1000_TDBAH(0): - //assert(!sc->esc_tx_enabled); sc->esc_TDBAH = value; + if (sc->esc_tx_enabled) + e82545_tx_update_tdba(sc); break; case E1000_TDLEN(0): - //assert(!sc->esc_tx_enabled); sc->esc_TDLEN = value & ~0xFFF0007F; + if (sc->esc_tx_enabled) + e82545_tx_update_tdba(sc); break; case E1000_TDH(0): //assert(!sc->esc_tx_enabled);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010231048.09NAmEW8090391>