Page MenuHomeFreeBSD

bhyve: Fix NVMe iovec construction for large IOs
ClosedPublic

Authored by chuck on Jun 25 2021, 3:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 20 2024, 5:40 AM
Unknown Object (File)
Feb 11 2024, 11:51 AM
Unknown Object (File)
Jan 30 2024, 5:15 PM
Unknown Object (File)
Jan 5 2024, 1:24 AM
Unknown Object (File)
Jan 3 2024, 6:37 AM
Unknown Object (File)
Jan 3 2024, 2:41 AM
Unknown Object (File)
Dec 24 2023, 10:36 PM
Unknown Object (File)
Dec 20 2023, 6:53 AM

Details

Summary

The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug
in the NVMe emulation's construction of iovec's.

By default, NVMe data transfer operations use a scatter-gather list in
which all entries point to a fixed size memory region. For example, if
the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists
themselves are also fixed size (default is 512 entries).

Because the list size is fixed, the last entry is special. If the IO
requires more than 512 entries, the last entry in the list contains the
address of the next list of entries. But if the IO requires exactly 512
entries, the last entry points to data.

The NVMe emulation missed this logic and unconditionally treated the
last entry as a pointer to the next list. Fix is to check if the
remaining data is greater than the page size before using the last entry
as a pointer to the next list.

PR: 256422
Reported by: dave@syix.com

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40134
Build 37023: arc lint + arc unit

Event Timeline

chuck requested review of this revision.Jun 25 2021, 3:31 PM

This looks good to me.

This revision is now accepted and ready to land.Jun 25 2021, 3:50 PM
This revision now requires review to proceed.Jun 27 2021, 10:00 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 27 2021, 10:23 PM
This revision was automatically updated to reflect the committed changes.