• Paolo Bonzini's avatar
    x86/KVM/VMX: Add L1D flush logic · 57880666
    Paolo Bonzini authored
    Add the logic for flushing L1D on VMENTER. The flush depends on the static
    key being enabled and the new l1tf_flush_l1d flag being set.
    
    The flags is set:
     - Always, if the flush module parameter is 'always'
    
     - Conditionally at:
       - Entry to vcpu_run(), i.e. after executing user space
    
       - From the sched_in notifier, i.e. when switching to a vCPU thread.
    
       - From vmexit handlers which are considered unsafe, i.e. where
         sensitive data can be brought into L1D:
    
         - The emulator, which could be a good target for other speculative
           execution-based threats,
    
         - The MMU, which can bring host page tables in the L1 cache.
    
         - External interrupts
    
         - Nested operations that require the MMU (see above). That is
           vmptrld, vmptrst, vmclear,vmwrite,vmread.
    
         - When handling invept,invvpid
    
    [ tglx: Split out from combo patch and reduced to a single flag ]
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    
    CVE-2018-3620
    CVE-2018-3646
    
    [smb: Moved change to kvm/mmu.c(kvm_handle_page_fault) into kvm/vmx.c
          before calling kvm_mmu_page_fault(). Left kvm/svm.c unmodified
          as AMD is not said to be affected.]
    Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
    57880666
x86.c 216 KB