* [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails
@ 2018-07-12 11:35 Vitaly Kuznetsov
2018-07-12 16:25 ` Jim Mattson
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2018-07-12 11:35 UTC (permalink / raw)
To: kvm
Cc: Paolo Bonzini, Radim Krčmář,
x86, Wanpeng Li, KarimAllah Ahmed, linux-kernel
Commit e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to represent
the running guest") introduced a regression in enter_vmx_non_root_mode():
when nested_vmx_load_msr() fails exit_qualification needs to point to the
entry number we failed to validate. Intel's SDM states:
"VM-entry failure due to MSR loading. The exit qualification is loaded to
indicate which entry in the VM-entry MSR-load area caused the problem (1
for the first entry, 2 for the second, etc.)."
Fixes: e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to represent the running guest")
Reported-by: Wanpeng Li <kernellwp@gmail.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/vmx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 65968649b365..be468c822892 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -11720,8 +11720,10 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu)
msr_entry_idx = nested_vmx_load_msr(vcpu,
vmcs12->vm_entry_msr_load_addr,
vmcs12->vm_entry_msr_load_count);
- if (msr_entry_idx)
+ if (msr_entry_idx) {
+ exit_qual = msr_entry_idx;
goto fail;
+ }
/*
* Note no nested_vmx_succeed or nested_vmx_fail here. At this point
--
2.14.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails
2018-07-12 11:35 [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails Vitaly Kuznetsov
@ 2018-07-12 16:25 ` Jim Mattson
2018-07-12 16:57 ` Vitaly Kuznetsov
0 siblings, 1 reply; 4+ messages in thread
From: Jim Mattson @ 2018-07-12 16:25 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm list, Paolo Bonzini, Radim Krčmář,
the arch/x86 maintainers, Wanpeng Li, KarimAllah Ahmed, LKML
This looks similar to my "[PATCH] kvm: nVMX: Restore exit qual for
VM-entry failure due to MSR loading"
On Thu, Jul 12, 2018 at 4:35 AM, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
> Commit e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to represent
> the running guest") introduced a regression in enter_vmx_non_root_mode():
> when nested_vmx_load_msr() fails exit_qualification needs to point to the
> entry number we failed to validate. Intel's SDM states:
>
> "VM-entry failure due to MSR loading. The exit qualification is loaded to
> indicate which entry in the VM-entry MSR-load area caused the problem (1
> for the first entry, 2 for the second, etc.)."
>
> Fixes: e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to represent the running guest")
> Reported-by: Wanpeng Li <kernellwp@gmail.com>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/kvm/vmx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 65968649b365..be468c822892 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -11720,8 +11720,10 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu)
> msr_entry_idx = nested_vmx_load_msr(vcpu,
> vmcs12->vm_entry_msr_load_addr,
> vmcs12->vm_entry_msr_load_count);
> - if (msr_entry_idx)
> + if (msr_entry_idx) {
> + exit_qual = msr_entry_idx;
> goto fail;
> + }
>
> /*
> * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
> --
> 2.14.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails
2018-07-12 16:25 ` Jim Mattson
@ 2018-07-12 16:57 ` Vitaly Kuznetsov
2018-07-15 14:30 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2018-07-12 16:57 UTC (permalink / raw)
To: Jim Mattson
Cc: kvm list, Paolo Bonzini, Radim Krčmář,
the arch/x86 maintainers, Wanpeng Li, KarimAllah Ahmed, LKML
Jim Mattson <jmattson@google.com> writes:
> This looks similar to my "[PATCH] kvm: nVMX: Restore exit qual for
> VM-entry failure due to MSR loading"
>
... which is still not in kvm/queue. Missed that, sorry! Let this one just
be a gentle ping then :-)
--
Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails
2018-07-12 16:57 ` Vitaly Kuznetsov
@ 2018-07-15 14:30 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2018-07-15 14:30 UTC (permalink / raw)
To: Vitaly Kuznetsov, Jim Mattson
Cc: kvm list, Radim Krčmář,
the arch/x86 maintainers, Wanpeng Li, KarimAllah Ahmed, LKML
On 12/07/2018 18:57, Vitaly Kuznetsov wrote:
> Jim Mattson <jmattson@google.com> writes:
>
>> This looks similar to my "[PATCH] kvm: nVMX: Restore exit qual for
>> VM-entry failure due to MSR loading"
>>
>
> ... which is still not in kvm/queue. Missed that, sorry! Let this one just
> be a gentle ping then :-)
>
I queued Jim's patch, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-15 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 11:35 [PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails Vitaly Kuznetsov
2018-07-12 16:25 ` Jim Mattson
2018-07-12 16:57 ` Vitaly Kuznetsov
2018-07-15 14:30 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).