Re: [PATCH] KVM: x86/mmu: Add sanity check that MMIO SPTE mask doesn't overlap gen

From: Sean Christopherson
Date: Wed Aug 03 2022 - 18:49:31 EST


On Thu, Aug 04, 2022, Kai Huang wrote:
> On Wed, 2022-08-03 at 21:33 +0000, Sean Christopherson wrote:
> > Add compile-time and init-time sanity checks to ensure that the MMIO SPTE
> > mask doesn't overlap the MMIO SPTE generation. The generation currently
> > avoids using bit 63, but that's as much coincidence as it is strictly
> > necessarly. That will change in the future, as TDX support will require
> > setting bit 63 (SUPPRESS_VE) in the mask. Explicitly carve out the bits
> > that are allowed in the mask so that any future shuffling of SPTE MMIO
> > bits doesn't silently break MMIO caching.
>
> Reviwed-by: Kai Huang <kai.huang@xxxxxxxxx>
>
> Btw, should you also check SPTE_MMU_PRESENT_MASK (or in another patch)?

Rats, I thought we already checked that, but it's only the MMIO generation that
checks for overlap. I'll send a v2.