0281-x86-kvm-Set-IBPB-when-switching-VM.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Tim Chen <[email protected]>
  3. Date: Fri, 13 Oct 2017 14:31:46 -0700
  4. Subject: [PATCH] x86/kvm: Set IBPB when switching VM
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5753
  9. CVE-2017-5715
  10. Set IBPB (Indirect branch prediction barrier) when switching VM.
  11. Signed-off-by: Tim Chen <[email protected]>
  12. Signed-off-by: Andy Whitcroft <[email protected]>
  13. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  14. (cherry picked from commit 665076ad780e8620505c742cfcb4b0f3fb99324a)
  15. Signed-off-by: Fabian Grünbichler <[email protected]>
  16. ---
  17. arch/x86/kvm/vmx.c | 3 +++
  18. 1 file changed, 3 insertions(+)
  19. diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
  20. index daff9962c90a..8df195bbb41d 100644
  21. --- a/arch/x86/kvm/vmx.c
  22. +++ b/arch/x86/kvm/vmx.c
  23. @@ -1488,6 +1488,7 @@ static void vmcs_load(struct vmcs *vmcs)
  24. if (error)
  25. printk(KERN_ERR "kvm: vmptrld %p/%llx failed\n",
  26. vmcs, phys_addr);
  27. +
  28. }
  29. #ifdef CONFIG_KEXEC_CORE
  30. @@ -2268,6 +2269,8 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
  31. if (per_cpu(current_vmcs, cpu) != vmx->loaded_vmcs->vmcs) {
  32. per_cpu(current_vmcs, cpu) = vmx->loaded_vmcs->vmcs;
  33. vmcs_load(vmx->loaded_vmcs->vmcs);
  34. + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
  35. + native_wrmsrl(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
  36. }
  37. if (!already_loaded) {
  38. --
  39. 2.14.2