Re: [Linaro-mm-sig] [PATCH 1/3] dma-buf: Add ioctl to query mmap info

From: Christian König
Date: Sun Aug 07 2022 - 14:05:27 EST


Am 07.08.22 um 19:56 schrieb Rob Clark:
On Sun, Aug 7, 2022 at 10:38 AM Christian König
<ckoenig.leichtzumerken@xxxxxxxxx> wrote:
[SNIP]
And exactly that was declared completely illegal the last time it came
up on the mailing list.

Daniel implemented a whole bunch of patches into the DMA-buf layer to
make it impossible for KVM to do this.
This issue isn't really with KVM, it is not making any CPU mappings
itself. KVM is just making the pages available to the guest.

Well I can only repeat myself: This is strictly illegal.

Please try this approach with CONFIG_DMABUF_DEBUG set. I'm pretty sure you will immediately run into a crash.

See this here as well https://elixir.bootlin.com/linux/v5.19/source/drivers/dma-buf/dma-buf.c#L653

Daniel intentionally added code to mangle the page pointers to make it impossible for KVM to do this.

If the virtio/virtgpu UAPI was build around the idea that this is possible then it is most likely fundamental broken.

Regards,
Christian.