From: Paolo Bonzini <pbonzini@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Oliver Upton <oupton@google.com>
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.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>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Krish Sadhukhan <krish.sadhukhan@oracle.com>,
Peter Shier <pshier@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: Set failure code in prepare_vmcs02()
Date: Tue, 30 Nov 2021 17:30:12 +0100 [thread overview]
Message-ID: <edcdcf27-384c-6dd9-ec91-4b0e45c8cade@redhat.com> (raw)
In-Reply-To: <20211130125337.GB24578@kili>
On 11/30/21 13:53, Dan Carpenter wrote:
> The error paths in the prepare_vmcs02() function are supposed to set
> *entry_failure_code but this path does not. It leads to using an
> uninitialized variable in the caller.
>
> Fixes: 71f7347025bf ("KVM: nVMX: Load GUEST_IA32_PERF_GLOBAL_CTRL MSR on VM-Entry")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> arch/x86/kvm/vmx/nested.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 315fa456d368..f321300883f9 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -2594,8 +2594,10 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
>
> if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) &&
> WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
> - vmcs12->guest_ia32_perf_global_ctrl)))
> + vmcs12->guest_ia32_perf_global_ctrl))) {
> + *entry_failure_code = ENTRY_FAIL_DEFAULT;
> return -EINVAL;
> + }
>
> kvm_rsp_write(vcpu, vmcs12->guest_rsp);
> kvm_rip_write(vcpu, vmcs12->guest_rip);
>
Yeah, I suppose that's the right thing to do (though it really shouldn't
happen because the value is checked earlier in
nested_vmx_check_guest_state).
Queued, thanks.
Paolo
prev parent reply other threads:[~2021-11-30 16:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 12:53 Dan Carpenter
2021-11-30 16:30 ` Paolo Bonzini [this message]
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=edcdcf27-384c-6dd9-ec91-4b0e45c8cade@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=dan.carpenter@oracle.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=krish.sadhukhan@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oupton@google.com \
--cc=pshier@google.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®