]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
KVM: SVM: Move spec control call after restore of GS
authorThomas Gleixner <tglx@linutronix.de>
Fri, 11 May 2018 13:21:01 +0000 (15:21 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 May 2018 07:59:19 +0000 (09:59 +0200)
svm_vcpu_run() invokes x86_spec_ctrl_restore_host() after VMEXIT, but
before the host GS is restored. x86_spec_ctrl_restore_host() uses 'current'
to determine the host SSBD state of the thread. 'current' is GS based, but
host GS is not yet restored and the access causes a triple fault.

Move the call after the host GS restore.

Fixes: 885f82bfbc6f x86/process: Allow runtime control of Speculative Store Bypass
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
CVE-2018-3639 (x86)

(backported from commit 15e6c22fd8e5a42c5ed6d487b7c9fe44c2517765)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/svm.c

index 6b1744499a90dc8bc477be535a0759ba31037c80..091925faa36a9df74a508942d3e6a2a2ccb90b8f 100644 (file)
@@ -4999,8 +4999,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
        /* Eliminate branch target predictions from guest mode */
        vmexit_fill_RSB();
 
-       x86_spec_ctrl_restore_host(svm->spec_ctrl);
-
 #ifdef CONFIG_X86_64
        wrmsrl(MSR_GS_BASE, svm->host.gs_base);
 #else
@@ -5010,6 +5008,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 #endif
 #endif
 
+       x86_spec_ctrl_restore_host(svm->spec_ctrl);
+
        reload_tss(vcpu);
 
        local_irq_disable();