0013-KVM-nVMX-unconditionally-cancel-preemption-timer-in-.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Peter Shier <[email protected]>
  3. Date: Mon, 25 Feb 2019 11:48:06 +0000
  4. Subject: [PATCH] KVM: nVMX: unconditionally cancel preemption timer in
  5. free_nested (CVE-2019-7221)
  6. Bugzilla: 1671904
  7. There are multiple code paths where an hrtimer may have been started to
  8. emulate an L1 VMX preemption timer that can result in a call to free_nested
  9. without an intervening L2 exit where the hrtimer is normally
  10. cancelled. Unconditionally cancel in free_nested to cover all cases.
  11. Embargoed until Feb 7th 2019.
  12. Signed-off-by: Peter Shier <[email protected]>
  13. Reported-by: Jim Mattson <[email protected]>
  14. Reviewed-by: Jim Mattson <[email protected]>
  15. Reported-by: Felix Wilhelm <[email protected]>
  16. Cc: [email protected]
  17. Message-Id: <[email protected]>
  18. Signed-off-by: Paolo Bonzini <[email protected]>
  19. CVE-2019-7221
  20. (backported from commit ecec76885bcfe3294685dc363fd1273df0d5d65f)
  21. [tyhicks: Backport to 4.18:
  22. - free_nested() is in arch/x86/kvm/vmx.c]
  23. Signed-off-by: Tyler Hicks <[email protected]>
  24. Signed-off-by: Thomas Lamprecht <[email protected]>
  25. ---
  26. arch/x86/kvm/vmx.c | 1 +
  27. 1 file changed, 1 insertion(+)
  28. diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
  29. index 7ade6cb125d3..37b095e7f00a 100644
  30. --- a/arch/x86/kvm/vmx.c
  31. +++ b/arch/x86/kvm/vmx.c
  32. @@ -7681,6 +7681,7 @@ static void free_nested(struct vcpu_vmx *vmx)
  33. if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon)
  34. return;
  35. + hrtimer_cancel(&vmx->nested.preemption_timer);
  36. vmx->nested.vmxon = false;
  37. vmx->nested.smm.vmxon = false;
  38. free_vpid(vmx->nested.vpid02);