Instead of blindly trusting the guest OS driver that it sends us well-
formed LUN addresses, check the LUN address for validity and fail the
request if it is invalid. While here, constify the members of the virtio
requests which aren't device-writable anyway.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 69048 Build 65931: arc lint + arc unit
Event Timeline
| usr.sbin/bhyve/pci_virtio_scsi.c | ||
|---|---|---|
| 412 | No, they must be zero, thats why we return false if any one of them isn't. | |
| 434–436 | Every code path using pci_vtscsi_get_lun() (and pci_vtscsi_get_target() in a later change) is supposed to use pci_vtscsi_check_lun() to check LUN validity before even getting there and return an appropriate error to the guest. Having these asserts in pci_vtscsi_get_lun() is thus a matter of defensive programming. These checks cost next to nothing, and they blow up only if there's a coding error, which is precisely what assertions are for. | |