[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59d45b27-9191-4136-929a-a7826ac891d8@redhat.com>
Date: Thu, 23 Sep 2021 16:05:46 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Borislav Petkov <bp@...en8.de>, Bandan Das <bsd@...hat.com>,
open list <linux-kernel@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>, Ingo Molnar <mingo@...hat.com>,
Wei Huang <wei.huang2@....com>,
Sean Christopherson <seanjc@...gle.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Jim Mattson <jmattson@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Wanpeng Li <wanpengli@...cent.com>
Subject: Re: [PATCH 03/14] KVM: x86: nSVM: test eax for 4K alignment for GP
errata workaround
On 14/09/21 17:48, Maxim Levitsky wrote:
> 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: 82a11e9c6fa2 ("KVM: SVM: Add emulation support for #GP triggered by SVM instructions")
>
> Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com>
> ---
> arch/x86/kvm/svm/svm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index b2e710a3fff6..6645542df9bd 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -2224,6 +2224,10 @@ static int gp_interception(struct kvm_vcpu *vcpu)
> if (error_code)
> goto reinject;
>
> + /* All SVM instructions expect page aligned RAX */
> + if (svm->vmcb->save.rax & ~PAGE_MASK)
> + goto reinject;
> +
> /* Decode the instruction for usage later */
> if (x86_decode_emulated_instruction(vcpu, 0, NULL, 0) != EMULATION_OK)
> goto reinject;
>
Queued, thanks.
Paolo
Powered by blists - more mailing lists