HomeFreeBSD

bhyve e1000: Sanitize transmit ring indices.

Description

bhyve e1000: Sanitize transmit ring indices.

When preparing to transmit pending packets, ensure that the head (TDH)
and tail (TDT) indices are in bounds. Note that validating values
when they are written is not sufficient along as the transmit length
(TDLEN) could be changed turning a value that was valid when written
into an out of bounds value.

While here, add further restrictions to the head register (TDH). The
manual states that writing to this value while transmit is enabled can
cause unexpected behavior and that it should only be written after a
reset. As such, ignore attempts to write while transmit is active,
and also ignore writes of non-zero values. Later e1000 chipsets have
this register as read-only.

Also ignore any attempts to transmit packets if the transmit ring's
size is zero.

PR: 264567
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36269

(cherry picked from commit 7afe342dcb38b624488009bb6bdfa5337e628ffc)

Details

Provenance
jhbAuthored on Aug 29 2022, 10:35 PM
Reviewer
emaste
Differential Revision
D36269: bhyve e1000: Sanitize transmit ring indices.
Parents
rG56dad65305af: cxgbe TOE TLS: Simplify a few routines.
Branches
Unknown
Tags
Unknown