Files
cloud-hypervisor/virtio-devices
Dylan Reid 326cd88074 virtio-devices: balloon: Clamp range to region before PUNCH_HOLE
release_memory_range took (range_base, range_len) verbatim from a
guest-controlled descriptor (free-page-reporting and inflate paths) and
called fallocate(PUNCH_HOLE | KEEP_SIZE) on the backing file before any
length check ran. find_region only validates that range_base lands
inside *some* region; range_len can extend past the region's end. When
the operator uses --memory-zone file=PATH against a host file larger
than the zone, the punch zeroes host file content past the guest's
memory extent.

Free-page reporting is advisory, so the VMM is allowed to act on a
subset of a free range. Clamp range_len to the bytes that actually fit
within the region returned by find_region. Going past the end of a
region is most likely a guest bug so log it.

Signed-off-by: Dylan Reid <dgreid@fb.com>
2026-04-25 18:35:21 +00:00
..