On Thu, Jun 20, 2024 at 11:00:45AM +0200, David Hildenbrand wrote:
Not sure if IOMMU + private makes that much sense really, but I think I might not really understand what you mean by this.
A device might be able to access private memory. In the TDX world, this would mean that a device "speaks" encrypted memory.
At the same time, a device might be able to access shared memory. Maybe devices can do both?
What do do when converting between private and shared? I think it depends on various factors (e.g., device capabilities).
The whole thing is complicated once you put the pages into the VMA. We have hmm_range_fault and IOMMU SVA paths that both obtain the pfns without any of the checks here.
(and I suspect many of the target HW's for pKVM have/will have SVA capable GPUs so SVA is an attack vector worth considering)
What happens if someone does DMA to these PFNs? It seems like nothing good in either scenario..
Really the only way to do it properly is to keep the memory unmapped, that must be the starting point to any solution. Denying GUP is just an ugly hack.
Jason