[PATCH v2 02/25] KVM: x86/mmu: nested EPT cannot be used in SMM

Paolo Bonzini posted 25 patches 3 years, 11 months ago
There is a newer version of this series
[PATCH v2 02/25] KVM: x86/mmu: nested EPT cannot be used in SMM
Posted by Paolo Bonzini 3 years, 11 months ago
The role.base.smm flag is always zero when setting up shadow EPT,
do not bother copying it over from vcpu->arch.root_mmu.

Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 7051040e15b3..4f9bbd02fb8b 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4886,9 +4886,11 @@ kvm_calc_shadow_ept_root_page_role(struct kvm_vcpu *vcpu, bool accessed_dirty,
 {
 	union kvm_mmu_role role = {0};
 
-	/* SMM flag is inherited from root_mmu */
-	role.base.smm = vcpu->arch.root_mmu.mmu_role.base.smm;
-
+	/*
+	 * KVM does not support SMM transfer monitors, and consequently does not
+	 * support the "entry to SMM" control either.  role.base.smm is always 0.
+	 */
+	WARN_ON_ONCE(is_smm(vcpu));
 	role.base.level = level;
 	role.base.has_4_byte_gpte = false;
 	role.base.direct = false;
-- 
2.31.1


Re: [PATCH v2 02/25] KVM: x86/mmu: nested EPT cannot be used in SMM
Posted by Sean Christopherson 3 years, 11 months ago
On Mon, Feb 21, 2022, Paolo Bonzini wrote:
> The role.base.smm flag is always zero when setting up shadow EPT,
> do not bother copying it over from vcpu->arch.root_mmu.
> 
> Reviewed-by: David Matlack <dmatlack@google.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>