crosvm/crosvm-fuzz
Daniel Verkamp 63f50362ec devices: virtio: overhaul DescriptorChain API
Summary: DescriptorChain now reads the full chain when it is created.

Previously, DescriptorChain worked more like an iterator, returning one
descriptor at a time. This meant that DescriptorChain::checked_new()
returning Ok(...) did not guarantee the whole chain was valid, so
callers - in particular, Reader::new() and Writer::new() - had to be
fallible so they could report errors.

With the new API, DescriptorChain::new() reads the whole chain of
descriptors before returning, validating the required properties that
were previously deferred to Reader/Writer creation errors. This means
that Reader::new() and Writer::new() can now be infallible, which
eliminates error cases all over virtio device code.

Since the Reader::new() and Writer::new() function signatures are
changing anyway, take the opportunity to remove the redundant
GuestMemory parameter to those functions; DescriptorChain already holds
a reference to the GuestMemory.

The internal structure of DescriptorChain has been modified in
preparation for supporting packed virtqueues (in addition to the current
split virtqueues). The queue-type-specific code has been factored into a
separate trait implementation (DescriptorChainIter) so it is separate
from the high-level descriptor chain validation logic and IOMMU
translation.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I48fd44b7f3e8b509dcb3683864a3f9621c744c4c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4391797
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
2023-04-26 20:27:16 +00:00
..
.gitignore
block_fuzzer.rs
Cargo.toml
fs_server_fuzzer.rs devices: virtio: overhaul DescriptorChain API 2023-04-26 20:27:16 +00:00
OWNERS
qcow_fuzzer.rs
usb_descriptor_fuzzer.rs
virtqueue_fuzzer.rs devices: virtio: overhaul DescriptorChain API 2023-04-26 20:27:16 +00:00
zimage_fuzzer.rs