0280-x86-mm-Set-IBPB-upon-context-switch.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Tim Chen <[email protected]>
  3. Date: Fri, 20 Oct 2017 12:56:29 -0700
  4. Subject: [PATCH] x86/mm: Set IBPB upon context switch
  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 on context switch with changing of page table.
  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 a3320203792b633fb96df5d0bbfb7036129b78e2)
  15. Signed-off-by: Fabian Grünbichler <[email protected]>
  16. ---
  17. arch/x86/mm/tlb.c | 4 ++++
  18. 1 file changed, 4 insertions(+)
  19. diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
  20. index 06f3854d0a4f..bb3ded3a4e5f 100644
  21. --- a/arch/x86/mm/tlb.c
  22. +++ b/arch/x86/mm/tlb.c
  23. @@ -12,6 +12,7 @@
  24. #include <asm/cache.h>
  25. #include <asm/apic.h>
  26. #include <asm/uv/uv.h>
  27. +#include <asm/microcode.h>
  28. #include <linux/debugfs.h>
  29. /*
  30. @@ -218,6 +219,9 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
  31. u16 new_asid;
  32. bool need_flush;
  33. + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
  34. + native_wrmsrl(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
  35. +
  36. if (IS_ENABLED(CONFIG_VMAP_STACK)) {
  37. /*
  38. * If our current stack is in vmalloc space and isn't
  39. --
  40. 2.14.2