Skip to content

Commit d1cba6c

Browse files
Maxim Levitskybonzini
authored andcommitted
KVM: x86: nSVM: test eax for 4K alignment for GP errata workaround
GP SVM errata workaround made the #GP handler always emulate the SVM instructions. However these instructions #GP in case the operand is not 4K aligned, but the workaround code didn't check this and we ended up emulating these instructions anyway. This is only an emulation accuracy check bug as there is no harm for KVM to read/write unaligned vmcb images. Fixes: 82a11e9 ("KVM: SVM: Add emulation support for #GP triggered by SVM instructions") Signed-off-by: Maxim Levitsky <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 1ad3210 commit d1cba6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,6 +2224,10 @@ static int gp_interception(struct kvm_vcpu *vcpu)
22242224
if (error_code)
22252225
goto reinject;
22262226

2227+
/* All SVM instructions expect page aligned RAX */
2228+
if (svm->vmcb->save.rax & ~PAGE_MASK)
2229+
goto reinject;
2230+
22272231
/* Decode the instruction for usage later */
22282232
if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK)
22292233
goto reinject;

0 commit comments

Comments
 (0)