Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DMA mappings are backed by contiguous memory on the host when using virtio-iommu #6329

Open
likebreath opened this issue Mar 25, 2024 · 1 comment
Assignees

Comments

@likebreath
Copy link
Member

likebreath commented Mar 25, 2024

Originally posted by @likebreath in #6297 (comment)

It makes sense to me that a DMA mapping needs to be continuous on the host side and hence should be within a single region in the guest (no matter it is GuestMemoryRegion or a MMIORegion).

Actually looking deeper at the check_range method in the vm_memory crate it does validate that the map request is within one region on the host,

I came to a different conclusion after reading its implementation from vm_memory crate. I believe vm_memory::guest_memory::GuestMemory::check_range() returns true as long as the range is valid even if the given range is backed by multiple regions. Please take another look here: https://github.com/rust-vmm/vm-memory/blob/b8bf1dbcca5d85a158cf7a8ed6cb19774428819c/src/guest_memory.rs#L648-L651.

If I am right, we have a bug here with using GuestMemory::check_range().

@rbradford rbradford changed the title Ensure DMA mappings are backed by continuous memory on the host when using virtio-iommu Ensure DMA mappings are backed by contiguous memory on the host when using virtio-iommu Mar 26, 2024
@thomasbarrett
Copy link
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants