Skip to content

Commit 37687c4

Browse files
Maxim Levitskybonzini
authored andcommitted
KVM: x86: reset pdptrs_from_userspace when exiting smm
When exiting SMM, pdpts are loaded again from the guest memory. This fixes a theoretical bug, when exit from SMM triggers entry to the nested guest which re-uses some of the migration code which uses this flag as a workaround for a legacy userspace. Signed-off-by: Maxim Levitsky <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e2e6e44 commit 37687c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/x86/kvm/x86.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7658,6 +7658,13 @@ static void kvm_smm_changed(struct kvm_vcpu *vcpu, bool entering_smm)
76587658

76597659
/* Process a latched INIT or SMI, if any. */
76607660
kvm_make_request(KVM_REQ_EVENT, vcpu);
7661+
7662+
/*
7663+
* Even if KVM_SET_SREGS2 loaded PDPTRs out of band,
7664+
* on SMM exit we still need to reload them from
7665+
* guest memory
7666+
*/
7667+
vcpu->arch.pdptrs_from_userspace = false;
76617668
}
76627669

76637670
kvm_mmu_reset_context(vcpu);

0 commit comments

Comments
 (0)