Page MenuHomeFreeBSD

bhyve virtio-scsi: Avoid out of bounds accesses to guest requests.
ClosedPublic

Authored by jhb on Aug 19 2022, 11:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 2 2024, 10:59 AM
Unknown Object (File)
Apr 27 2024, 10:41 AM
Unknown Object (File)
Dec 20 2023, 7:01 AM
Unknown Object (File)
Dec 12 2023, 12:09 PM
Unknown Object (File)
Oct 27 2023, 7:24 PM
Unknown Object (File)
Aug 5 2023, 6:12 AM
Unknown Object (File)
Aug 4 2023, 2:41 AM
Unknown Object (File)
Jun 24 2023, 3:08 AM

Details

Summary
  • Ignore I/O requests with insufficiently sized input or output buffers (those not containing compete request headers).
  • Ignore control requests with improperly sized buffers.
  • While here, explicitly zero the output header of an I/O request to avoid leaking malloc garbage from the host if the header is not fully populated.

PR: 264521
Reported by: Robert Morris <rtm@lcs.mit.edu>
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Aug 19 2022, 11:42 PM

I have only compiled this, I have not run-tested it as I don't have a virtio-scsi setup handy.

Looks good to me with one comment.

usr.sbin/bhyve/pci_virtio_scsi.c
375

I wonder whether we should be more relaxed here with < ? Can the structure grow in later versions?

This revision is now accepted and ready to land.Aug 20 2022, 9:03 PM
usr.sbin/bhyve/pci_virtio_scsi.c
375

There isn't a version in the struct, so I think this is a safe choice. We can always change this if and when we learn about a new/larger struct.

usr.sbin/bhyve/pci_virtio_scsi.c
375

The current 1.1 spec says the payload of both of these commands is a fixed size. I agree that we can relax this in the future if needed.