FAILED: patch "[PATCH] KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from" failed to apply to 4.19-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3b013a2972d5bc344d6eaa8f24fdfe268211e45f Mon Sep 17 00:00:00 2001
From: Sean Christopherson <[email protected]>
Date: Tue, 7 May 2019 09:06:28 -0700
Subject: [PATCH] KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from
vmcs01
If L1 does not set VM_ENTRY_LOAD_BNDCFGS, then L1's BNDCFGS value must be propagated to vmcs02 since KVM always runs with VM_ENTRY_LOAD_BNDCFGS when MPX is supported. Because the value effectively comes from vmcs01, vmcs02 must be updated even if vmcs12 is clean.
arch/x86/kvm/vmx/nested.c +6 -7
@@ -2228,13 +2228,9 @@ static void prepare_vmcs02_rare(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)set_cr4_guest_host_mask (vmx); -if (kvm_mpx_supported ()) { -if (vmx->nested.nested_run_pending && - (vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS )) -vmcs_write64 (GUEST_BNDCFGS , vmcs12->guest_bndcfgs); -else -vmcs_write64 (GUEST_BNDCFGS , vmx->nested.vmcs01_guest_bndcfgs); - } +if (kvm_mpx_supported () && vmx->nested.nested_run_pending && + (vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS )) +vmcs_write64 (GUEST_BNDCFGS , vmcs12->guest_bndcfgs); }/*
@@ -2266,6 +2262,9 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,kvm_set_dr (vcpu,7 , vcpu->arch.dr7);vmcs_write64 (GUEST_IA32_DEBUGCTL , vmx->nested.vmcs01_debugctl); } +if (kvm_mpx_supported () && (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls &VM_ENTRY_LOAD_BNDCFGS ))) +vmcs_write64 (GUEST_BNDCFGS , vmx->nested.vmcs01_guest_bndcfgs);vmx_set_rflags (vcpu, vmcs12->guest_rflags);/* EXCEPTION_BITMAP and CR0_GUEST_HOST_MASK should basically be the