Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table

From: Dave Hansen
Date: Mon Apr 19 2021 - 14:33:17 EST


On 4/19/21 11:10 AM, Andy Lutomirski wrote:
> I’m confused by this scenario. This should only affect physical pages
> that are in the 2M area that contains guest memory. But, if we have a
> 2M direct map PMD entry that contains kernel data and guest private
> memory, we’re already in a situation in which the kernel touching
> that memory would machine check, right?

Not machine check, but page fault. Do machine checks even play a
special role in SEV-SNP? I thought that was only TDX?

My point was just that you can't _easily_ do the 2M->4k kernel mapping
demotion in a page fault handler, like I think Borislav was suggesting.

> ISTM we should fully unmap any guest private page from the kernel and
> all host user pagetables before actually making it be a guest private
> page.

Yes, that sounds attractive. Then, we'd actually know if the host
kernel was doing stray reads somehow because we'd get a fault there too.