Skip to content

Commit

Permalink
KVM: SVM: Cannot re-initialize the VMCB after shutdown with SEV-ES
Browse files Browse the repository at this point in the history
When a SHUTDOWN VMEXIT is encountered, normally the VMCB is re-initialized
so that the guest can be re-launched. But when a guest is running as an
SEV-ES guest, the VMSA cannot be re-initialized because it has been
encrypted. For now, just return -EINVAL to prevent a possible attempt at
a guest reset.

Signed-off-by: Tom Lendacky <[email protected]>
Message-Id: <aa6506000f6f3a574de8dbcdab0707df844cb00c.1607620209.git.thomas.lendacky@amd.com>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
tlendacky authored and bonzini committed Dec 15, 2020
1 parent bc624d9 commit 8164a5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/x86/kvm/svm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,13 @@ static int shutdown_interception(struct vcpu_svm *svm)
{
struct kvm_run *kvm_run = svm->vcpu.run;

/*
* The VM save area has already been encrypted so it
* cannot be reinitialized - just terminate.
*/
if (sev_es_guest(svm->vcpu.kvm))
return -EINVAL;

/*
* VMCB is undefined after a SHUTDOWN intercept
* so reinitialize it.
Expand Down

0 comments on commit 8164a5f

Please sign in to comment.