]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: Update TX descriptor base address and host mapping on change
authorfreqlabs <freqlabs@FreeBSD.org>
Fri, 16 Oct 2020 20:27:20 +0000 (20:27 +0000)
committerfreqlabs <freqlabs@FreeBSD.org>
Fri, 16 Oct 2020 20:27:20 +0000 (20:27 +0000)
commite279285d327695191d69e6b145b2bf16c18a2126
tree490a644b7de9e49e68faea36477ae20bc4accbd1
parent5881a1a070354028800a888906f57020340d4a44
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)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26798
usr.sbin/bhyve/pci_e82545.c