Re: [PATCH 00/16] KVM: arm64: MMIO guard PV services

From: Andrew Jones
Date: Wed Jul 21 2021 - 17:42:51 EST


On Thu, Jul 15, 2021 at 05:31:43PM +0100, Marc Zyngier wrote:
> KVM/arm64 currently considers that any memory access outside of a
> memslot is a MMIO access. This so far has served us very well, but
> obviously relies on the guest trusting the host, and especially
> userspace to do the right thing.
>
> As we keep on hacking away at pKVM, it becomes obvious that this trust
> model is not really fit for a confidential computing environment, and
> that the guest would require some guarantees that emulation only
> occurs on portions of the address space that have clearly been
> identified for this purpose.

This trust model is hard for me to reason about. userspace is trusted to
control the life cycle of the VM, to prepare the memslots for the VM,
and [presumably] identify what MMIO ranges are valid, yet it's not
trusted to handle invalid MMIO accesses. I'd like to learn more about
this model and the userspace involved.

>
> This series aims at providing the two sides of the above coin:
>
> - a set of PV services (collectively called 'MMIO guard' -- better
> name required!) where the guest can flag portion of its address
> space that it considers as MMIO, with map/unmap semantics. Any
> attempt to access a MMIO range outside of these regions will result
> in an external abort being injected.
>
> - a set of hooks into the ioremap code allowing a Linux guest to tell
> KVM about things it want to consider as MMIO. I definitely hate this
> part of the series, as it feels clumsy and brittle.
>
> For now, the enrolment in this scheme is controlled by a guest kernel
> command-line parameters, but it is expected that KVM will enforce this
> for protected VMs.
>
> Note that this crucially misses a save/restore interface for non
> protected VMs, and I currently don't have a good solution for
> that. Ideas welcome.
>
> I also plan to use this series as a base for some other purposes,
> namely to trick the guest in telling us how it maps things like
> prefetchable BARs (see the discussion at [1]). That part is not
> implemented yet, but there is already some provision to pass the MAIR
> index across.
>
> Patches on top of 5.14-rc1, branch pushed at the usual location.
>
> [1] 20210429162906.32742-1-sdonthineni@xxxxxxxxxx

The fun never stops.

Thanks,
drew