mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
process_queue_submit's drain loop builds a fresh queue.iter() per iteration, which re-reads the guest avail index on every call and has no per-call cap (the per-iter gap check in virtio-queue only protects against avail_idx jumping more than queue_size between two reads). In theory, a malicous or buggy guest could keep adding descriptors and cause this loop to overflow the iouring submit queue. Cap a single drain at queue_size. A spec-compliant driver never produces more than queue_size outstanding entries simultaneously, so the cap is invisible to well-behaved guests. Signed-off-by: Dylan Reid <dgreid@fb.com>