0147-x86-entry-gdt-Put-per-CPU-GDT-remaps-in-ascending-or.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Andy Lutomirski <[email protected]>
  3. Date: Mon, 4 Dec 2017 15:07:14 +0100
  4. Subject: [PATCH] x86/entry/gdt: Put per-CPU GDT remaps in ascending order
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5754
  9. We currently have CPU 0's GDT at the top of the GDT range and
  10. higher-numbered CPUs at lower addresses. This happens because the
  11. fixmap is upside down (index 0 is the top of the fixmap).
  12. Flip it so that GDTs are in ascending order by virtual address.
  13. This will simplify a future patch that will generalize the GDT
  14. remap to contain multiple pages.
  15. Signed-off-by: Andy Lutomirski <[email protected]>
  16. Signed-off-by: Thomas Gleixner <[email protected]>
  17. Reviewed-by: Borislav Petkov <[email protected]>
  18. Reviewed-by: Thomas Gleixner <[email protected]>
  19. Cc: Boris Ostrovsky <[email protected]>
  20. Cc: Borislav Petkov <[email protected]>
  21. Cc: Borislav Petkov <[email protected]>
  22. Cc: Brian Gerst <[email protected]>
  23. Cc: Dave Hansen <[email protected]>
  24. Cc: Dave Hansen <[email protected]>
  25. Cc: David Laight <[email protected]>
  26. Cc: Denys Vlasenko <[email protected]>
  27. Cc: Eduardo Valentin <[email protected]>
  28. Cc: Greg KH <[email protected]>
  29. Cc: H. Peter Anvin <[email protected]>
  30. Cc: Josh Poimboeuf <[email protected]>
  31. Cc: Juergen Gross <[email protected]>
  32. Cc: Linus Torvalds <[email protected]>
  33. Cc: Peter Zijlstra <[email protected]>
  34. Cc: Rik van Riel <[email protected]>
  35. Cc: Will Deacon <[email protected]>
  36. Cc: [email protected]
  37. Cc: [email protected]
  38. Cc: [email protected]
  39. Cc: [email protected]
  40. Link: https://lkml.kernel.org/r/[email protected]
  41. Signed-off-by: Ingo Molnar <[email protected]>
  42. (cherry picked from commit aaeed3aeb39c1ba69f0a49baec8cb728121d0a91)
  43. Signed-off-by: Andy Whitcroft <[email protected]>
  44. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  45. (cherry picked from commit 9c37967fad2d6a525df53e0a40edcd652e5abaae)
  46. Signed-off-by: Fabian Grünbichler <[email protected]>
  47. ---
  48. arch/x86/include/asm/desc.h | 2 +-
  49. 1 file changed, 1 insertion(+), 1 deletion(-)
  50. diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
  51. index f995e5a09136..22ee0a93b4f7 100644
  52. --- a/arch/x86/include/asm/desc.h
  53. +++ b/arch/x86/include/asm/desc.h
  54. @@ -61,7 +61,7 @@ static inline struct desc_struct *get_current_gdt_rw(void)
  55. /* Get the fixmap index for a specific processor */
  56. static inline unsigned int get_cpu_gdt_ro_index(int cpu)
  57. {
  58. - return FIX_GDT_REMAP_BEGIN + cpu;
  59. + return FIX_GDT_REMAP_END - cpu;
  60. }
  61. /* Provide the fixmap address of the remapped GDT */
  62. --
  63. 2.14.2