]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Add sanity check that MMIO SPTE mask doesn't overlap gen
authorSean Christopherson <seanjc@google.com>
Fri, 5 Aug 2022 19:41:33 +0000 (19:41 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Aug 2022 19:08:26 +0000 (15:08 -0400)
commitd1b6a8ec49b6332bc34a8877d79d630a44b9e873
treeefbc7fc190897deaa92f745bb89548c4ba2fec59
parentc24e7d4ecdb1d0dfe1b02e2dcfff76dfc7ab73eb
KVM: x86/mmu: Add sanity check that MMIO SPTE mask doesn't overlap gen

Add compile-time and init-time sanity checks to ensure that the MMIO SPTE
mask doesn't overlap the MMIO SPTE generation or the MMU-present bit.
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 bits doesn't silently break MMIO caching (KVM
has broken MMIO caching more than once due to overlapping the generation
with other things).

Suggested-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Message-Id: <20220805194133.86299-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h