[lkml]   [2018]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] x86/kvm/nVMX: set exit_qualification correctly when nested_vmx_load_msr() fails
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 <>
Signed-off-by: Vitaly Kuznetsov <>
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,
- 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
 \ /
  Last update: 2018-07-15 22:05    [W:0.057 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site