From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Wanpeng Li" <wanpengli@tencent.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, kvm@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
Date: Tue, 27 Aug 2019 12:28:09 +0000 [thread overview]
Message-ID: <871rx6n67a.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190827093852.GA8443@mwanda>
Dan Carpenter <dan.carpenter@oracle.com> writes:
> We refactored this code a bit and accidentally deleted the "-" character
> from "-EINVAL". The kvm_vcpu_map() function never returns positive
> EINVAL.
>
> Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis. I don't really know the impact.
>
>
> arch/x86/kvm/svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f220a85514f..ef646e22d1ab 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3598,7 +3598,7 @@ static int nested_svm_vmrun(struct vcpu_svm *svm)
> vmcb_gpa = svm->vmcb->save.rax;
>
> ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
> - if (ret = EINVAL) {
> + if (ret = -EINVAL) {
> kvm_inject_gp(&svm->vcpu, 0);
> return 1;
> } else if (ret) {
I was hoping that my patch was OK and Paolo screwed it upon commit but
no, it's the same in my local branch and I'm left without excuses :-)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Wanpeng Li" <wanpengli@tencent.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, kvm@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
Date: Tue, 27 Aug 2019 14:28:09 +0200 [thread overview]
Message-ID: <871rx6n67a.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190827093852.GA8443@mwanda>
Dan Carpenter <dan.carpenter@oracle.com> writes:
> We refactored this code a bit and accidentally deleted the "-" character
> from "-EINVAL". The kvm_vcpu_map() function never returns positive
> EINVAL.
>
> Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis. I don't really know the impact.
>
>
> arch/x86/kvm/svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f220a85514f..ef646e22d1ab 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3598,7 +3598,7 @@ static int nested_svm_vmrun(struct vcpu_svm *svm)
> vmcb_gpa = svm->vmcb->save.rax;
>
> ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
> - if (ret == EINVAL) {
> + if (ret == -EINVAL) {
> kvm_inject_gp(&svm->vcpu, 0);
> return 1;
> } else if (ret) {
I was hoping that my patch was OK and Paolo screwed it upon commit but
no, it's the same in my local branch and I'm left without excuses :-)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
next prev parent reply other threads:[~2019-08-27 12:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 9:38 [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun() Dan Carpenter
2019-08-27 9:38 ` Dan Carpenter
2019-08-27 12:28 ` Vitaly Kuznetsov [this message]
2019-08-27 12:28 ` Vitaly Kuznetsov
2019-08-27 13:39 ` Sean Christopherson
2019-08-27 13:39 ` Sean Christopherson
2019-09-11 15:28 ` Paolo Bonzini
2019-09-11 15:28 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rx6n67a.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=bp@alien8.de \
--cc=dan.carpenter@oracle.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.