Re: Unmapping KVM Guest Memory from Host Kernel

Matthew Wilcox
2024-03-09T05:01:57Z

On Fri, Mar 08, 2024 at 03:50:05PM +0000, Gowans, James wrote:
> Currently when using anonymous memory for KVM guest RAM, the memory all
> remains mapped into the kernel direct map. We are looking at options to
> get KVM guest memory out of the kernel’s direct map as a principled
> approach to mitigating speculative execution issues in the host kernel.
> Our goal is to more completely address the class of issues whose leak
> origin is categorized as "Mapped memory" [1].

One of the things that is holding Linux back is the inability to do I/O
to memory which is not part of memmap. _So Much_ of our infrastructure
is based on having a struct page available to stick into an sglist, bio,
skb_frag, or whatever. The solution to this is to move to a (phys_addr,
length) tuple instead of (page, offset, len) tuple. I call this "phyr"
and I've written about it before. I'm not working on this as I have
quite enough to do with the folio work, but I hope somebody works on it
before I get time to.