]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/kvm/vmx: Add MDS protection when L1D Flush is not active
authorThomas Gleixner <tglx@linutronix.de>
Thu, 28 Mar 2019 17:57:19 +0000 (13:57 -0400)
committerMihai Carabas <mihai.carabas@oracle.com>
Mon, 22 Apr 2019 18:16:17 +0000 (21:16 +0300)
commit 650b68a0622f933444a6d66936abb3103029413b upstream

CPUs which are affected by L1TF and MDS mitigate MDS with the L1D Flush on
VMENTER when updated microcode is installed.

If a CPU is not affected by L1TF or if the L1D Flush is not in use, then
MDS mitigation needs to be invoked explicitly.

For these cases, follow the host mitigation state and invoke the MDS
mitigation before VMENTER.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jon Masters <jcm@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
(cherry picked from commit f0da457fb20b9f321adb8acce0c287eff6f850d1)

Orabug: 29526900
CVE: CVE-2018-12126
CVE: CVE-2018-12130
CVE: CVE-2018-12127

Signed-off-by: Kanth Ghatraju <kanth.ghatraju@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Conflicts:
Changes from bugs.c imported to bugs_64.c

arch/x86/kernel/cpu/bugs_64.c
arch/x86/kvm/vmx.c

index 49900fa752f898fc04fcd9a30b814404cb3c3fac..cf9bfe883a87f70119fda2eb39e59737d0a83811 100644 (file)
@@ -171,6 +171,7 @@ u64 x86_amd_ls_cfg_ssbd_mask;
 
 /* Control MDS CPU buffer clear before returning to user space */
 DEFINE_STATIC_KEY_FALSE(mds_user_clear);
+EXPORT_SYMBOL_GPL(mds_user_clear);
 
 void __init check_bugs(void)
 {
index 250b28fcb9ba5f9a1cfe10752d6586aedef0acd8..c51b472c6147c4199d98a0ceb22cd97c1491cd58 100644 (file)
@@ -8558,6 +8558,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
 
        if (unlikely(static_key_enabled(&vmx_l1d_should_flush)))
                vmx_l1d_flush(vcpu);
+       else if (static_branch_unlikely(&mds_user_clear))
+               mds_clear_cpu_buffers();
 
        asm(
                /* Store host registers */