Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Manwaring, Derek
On 2024-05-13 13:36-0700, Sean Christopherson wrote: > Hmm, a slightly crazy idea (ok, maybe wildly crazy) would be to support > mapping > all of guest_memfd into kernel address space, but as USER=1 mappings.  I.e. > don't > require a carve-out from userspace, but do require CLAC/STAC when

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Sean Christopherson
On Mon, May 13, 2024, James Gowans wrote: > On Mon, 2024-05-13 at 10:09 -0700, Sean Christopherson wrote: > > On Mon, May 13, 2024, James Gowans wrote: > > > On Mon, 2024-05-13 at 08:39 -0700, Sean Christopherson wrote: > > > > > Sean, you mentioned that you envision guest_memfd also supporting >

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Gowans, James
On Mon, 2024-05-13 at 10:09 -0700, Sean Christopherson wrote: > On Mon, May 13, 2024, James Gowans wrote: > > On Mon, 2024-05-13 at 08:39 -0700, Sean Christopherson wrote: > > > > Sean, you mentioned that you envision guest_memfd also supporting > > > > non-CoCo VMs. > > > > Do you have some

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Sean Christopherson
On Mon, May 13, 2024, James Gowans wrote: > On Mon, 2024-05-13 at 08:39 -0700, Sean Christopherson wrote: > > > Sean, you mentioned that you envision guest_memfd also supporting > > > non-CoCo VMs. > > > Do you have some thoughts about how to make the above cases work in the > > > guest_memfd

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Gowans, James
On Mon, 2024-05-13 at 08:39 -0700, Sean Christopherson wrote: > > Sean, you mentioned that you envision guest_memfd also supporting non-CoCo > > VMs. > > Do you have some thoughts about how to make the above cases work in the > > guest_memfd context? > > Yes.  The hand-wavy plan is to allow

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Sean Christopherson
On Mon, May 13, 2024, Patrick Roy wrote: > For non-CoCo VMs, where memory is not encrypted, and the threat model assumes > a > trusted host userspace, we would like to avoid changing the VM model so > completely. If we adopt CoCo’s approaches where KVM / Userspace touches guest > memory we would

Re: Unmapping KVM Guest Memory from Host Kernel

2024-05-13 Thread Patrick Roy
Hi all, On 3/9/24 11:14, Mike Rapoport wrote: >>> >>> With this in mind, what’s the best way to solve getting guest RAM out of >>> >>> the direct map? Is memfd_secret integration with KVM the way to go, or >>> >>> should we build a solution on top of guest_memfd, for example via some >>> >>>

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-18 Thread Brendan Jackman
On Fri, 8 Mar 2024 at 18:36, David Matlack wrote: > I'm not sure if ASI provides a solution to the problem James is trying > to solve. ASI creates a separate "restricted" address spaces where, yes, > guest memory can be not mapped. But any access to guest memory is > still allowed. An access

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-14 Thread Manwaring, Derek
On Fri, 8 Mar 2024 15:22:50 -0800, Sean Christopherson wrote: > On Fri, Mar 08, 2024, James Gowans wrote: > > We are also aware of ongoing work on guest_memfd. The current > > implementation unmaps guest memory from VMM address space, but leaves it > > in the kernel’s direct map. We’re not looking

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-11 Thread Fuad Tabba
On Mon, Mar 11, 2024 at 9:26 AM Fuad Tabba wrote: > > Hi, > > On Fri, Mar 8, 2024 at 9:05 PM Manwaring, Derek wrote: > > > > On 2024-03-08 at 10:46-0700, David Woodhouse wrote: > > > On Fri, 2024-03-08 at 09:35 -0800, David Matlack wrote: > > > > I think what James is looking for (and what we

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-11 Thread Fuad Tabba
Hi, On Fri, Mar 8, 2024 at 9:05 PM Manwaring, Derek wrote: > > On 2024-03-08 at 10:46-0700, David Woodhouse wrote: > > On Fri, 2024-03-08 at 09:35 -0800, David Matlack wrote: > > > I think what James is looking for (and what we are also interested > > > in), is _eliminating_ the ability to

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-09 Thread Mike Rapoport
On Fri, Mar 08, 2024 at 03:22:50PM -0800, Sean Christopherson wrote: > On Fri, Mar 08, 2024, James Gowans wrote: > > However, memfd_secret doesn’t work out the box for KVM guest memory; the > > main reason seems to be that the GUP path is intentionally disabled for > > memfd_secret, so if we use a

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Matthew Wilcox
On Fri, Mar 08, 2024 at 03:50:05PM +, 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

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Manwaring, Derek
On 2024-03-08 10:36-0700, David Matlack wrote: > On Fri, Mar 8, 2024 at 8:25 AM Brendan Jackman wrote: > > On Fri, 8 Mar 2024 at 16:50, Gowans, James wrote: > > > Our goal is to more completely address the class of issues whose leak > > > origin is categorized as "Mapped memory" [1]. > > > > Did

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Sean Christopherson
On Fri, Mar 08, 2024, James Gowans wrote: > However, memfd_secret doesn’t work out the box for KVM guest memory; the > main reason seems to be that the GUP path is intentionally disabled for > memfd_secret, so if we use a memfd_secret backed VMA for a memslot then > KVM is not able to fault the

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread David Matlack
On Fri, Mar 8, 2024 at 8:25 AM Brendan Jackman wrote: > > Hi James > > On Fri, 8 Mar 2024 at 16:50, Gowans, James wrote: > > Our goal is to more completely address the class of issues whose leak > > origin is categorized as "Mapped memory" [1]. > > Did you forget a link below? I'm interested in

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Manwaring, Derek
On 2024-03-08 at 10:46-0700, David Woodhouse wrote: > On Fri, 2024-03-08 at 09:35 -0800, David Matlack wrote: > > I think what James is looking for (and what we are also interested > > in), is _eliminating_ the ability to access guest memory from the > > direct map entirely. And in general,

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Sean Christopherson
On Fri, Mar 08, 2024, David Woodhouse wrote: > On Fri, 2024-03-08 at 09:35 -0800, David Matlack wrote: > > I think what James is looking for (and what we are also interested > > in), is _eliminating_ the ability to access guest memory from the > > direct map entirely. And in general, eliminate the

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread David Woodhouse
On Fri, 2024-03-08 at 09:35 -0800, David Matlack wrote: > I think what James is looking for (and what we are also interested > in), is _eliminating_ the ability to access guest memory from the > direct map entirely. And in general, eliminate the ability to access > guest memory in as many ways as

Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Gowans, James
Hello KVM, MM and memfd_secret folks, 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

Re: Unmapping KVM Guest Memory from Host Kernel

2024-03-08 Thread Brendan Jackman
Hi James On Fri, 8 Mar 2024 at 16:50, Gowans, James wrote: > Our goal is to more completely address the class of issues whose leak > origin is categorized as "Mapped memory" [1]. Did you forget a link below? I'm interested in hearing about that categorisation. > ... what’s the best way to