Skip to content

vm-memory: Clarify that custom GuestMemoryRegion implementations must not return zero length #50

Description

@xc01

The built-in mmap-backed region path already rejects zero-sized mappings, so this doesn't seem to affect the normal GuestMemoryMmap flow.

However, GuestMemoryRegion is a public extension trait intended for custom memory backends, and I couldn't find documentation stating that len() must be non-zero.

A custom implementation returning 0 can be accepted by GuestRegionCollection::from_regions(), but later code assumes non-empty regions:

self.start_addr().unchecked_add(self.len() - 1)

This makes the invariant implicit rather than documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions