You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vring validation was a bit awkwardly split across two functions which
did overlapping sets of checks: Queue::initialize verified alignment and
memory accesses, while Queue::is_valid additionally checked Queue::ready
and Queue::size. However, on the activation path, both were called,
meanign we checked alignment twice (.initialize() is called in
.activate(), but we only call .activate() if .is_valid() returned true).
This is confusing at best, and at worst made us potentially virtio spec
incompliant: If the quest tried to activate a virtio device, but
this failed because some vring was not valid (in terms of
Queue::is_valid), then Firecracker would silently ignore the activation
request. Now, it instead marks the device as needing reset, and notifies
the guest of its failure to properly configure the vrings.
While we're at it, also remove some duplicated checks from the vring
restoration code: .initialize() is called for activated devices, so
there's no need to later validate the size specifically again, and also
no need for the additional call to is_valid().
Fix up some unit tests that activate virtio devices where some queues do
not satisfy the old Queue::is_valid() checks, as now these checks must
pass for activation to succeed. The only interesting fix here is in
test_virtiodev_sanity_checks in virtio/persist.rs, which can be seen as
a symptom of a bug fix: Previously, restoration code refused to load
snapshots that had their queue size set to a value larger than
Queue::max_size, even if a device was not activated. This is arguably
wrong, as The guest can configure a queue to have a size greater than
max size no problem, and never activate the device for example, in which
case prior to this commit Firecracker would refuse to resume snapshots
taken of such VMs.
Signed-off-by: Patrick Roy <[email protected]>
0 commit comments