X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:31:42 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/206587a9fb764d71f035dc7f6d3b6488f5d5b304
Commit:     206587a9fb764d71f035dc7f6d3b6488f5d5b304
Parent:     928a4c39484281f8ca366f53a1db79330d058401
Refname:    refs/heads/master
Author:     KarimAllah Ahmed <[email protected]>
AuthorDate: Sat Feb 10 23:39:25 2018 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 13 09:00:06 2018 +0100

    X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs
    
    These two variables should check whether SPEC_CTRL and PRED_CMD are
    supposed to be passed through to L2 guests or not. While
    msr_write_intercepted_l01 would return 'true' if it is not passed through.
    
    So just invert the result of msr_write_intercepted_l01 to implement the
    correct semantics.
    
    Signed-off-by: KarimAllah Ahmed <[email protected]>
    Signed-off-by: David Woodhouse <[email protected]>
    Reviewed-by: Jim Mattson <[email protected]>
    Acked-by: Paolo Bonzini <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Arjan van de Ven <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Dan Williams <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: David Woodhouse <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Radim Krčmář <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Fixes: 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL")
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/kvm/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bee4c49f6dd0..599179bfb87f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10219,8 +10219,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
 	 *    updated to reflect this when L1 (or its L2s) actually write to
 	 *    the MSR.
 	 */
-	bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
-	bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
+	bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
+	bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
 
 	if (!nested_cpu_has_virt_x2apic_mode(vmcs12) &&
 	    !pred_cmd && !spec_ctrl)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html