0285-x86-kvm-Toggle-IBRS-on-VM-entry-and-exit.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Tim Chen <[email protected]>
  3. Date: Fri, 20 Oct 2017 17:04:35 -0700
  4. Subject: [PATCH] x86/kvm: Toggle IBRS on VM entry and exit
  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. Restore guest IBRS on VM entry and set it to 1 on VM exit
  11. back to kernel.
  12. Signed-off-by: Tim Chen <[email protected]>
  13. Signed-off-by: Andy Whitcroft <[email protected]>
  14. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  15. (cherry picked from commit 3dc28210342f174270bcefac74ef5d0b52ffd846)
  16. Signed-off-by: Fabian Grünbichler <[email protected]>
  17. ---
  18. arch/x86/kvm/vmx.c | 5 +++++
  19. 1 file changed, 5 insertions(+)
  20. diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
  21. index 8df195bbb41d..57d538fc7c75 100644
  22. --- a/arch/x86/kvm/vmx.c
  23. +++ b/arch/x86/kvm/vmx.c
  24. @@ -9101,6 +9101,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
  25. __write_pkru(vcpu->arch.pkru);
  26. atomic_switch_perf_msrs(vmx);
  27. +
  28. + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
  29. + add_atomic_switch_msr(vmx, MSR_IA32_SPEC_CTRL,
  30. + vcpu->arch.spec_ctrl, FEATURE_ENABLE_IBRS);
  31. +
  32. debugctlmsr = get_debugctlmsr();
  33. vmx_arm_hv_timer(vcpu);
  34. --
  35. 2.14.2