0076-x86-xen-Provide-pre-built-page-tables-only-for-CONFI.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From cac8711a9ba742e97090cc5ec522360f1549c584 Mon Sep 17 00:00:00 2001
  2. From: "Kirill A. Shutemov" <[email protected]>
  3. Date: Fri, 29 Sep 2017 17:08:19 +0300
  4. Subject: [PATCH 076/242] x86/xen: Provide pre-built page tables only for
  5. CONFIG_XEN_PV=y and CONFIG_XEN_PVH=y
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. Looks like we only need pre-built page tables in the CONFIG_XEN_PV=y and
  11. CONFIG_XEN_PVH=y cases.
  12. Let's not provide them for other configurations.
  13. Signed-off-by: Kirill A. Shutemov <[email protected]>
  14. Reviewed-by: Juergen Gross <[email protected]>
  15. Cc: Andrew Morton <[email protected]>
  16. Cc: Andy Lutomirski <[email protected]>
  17. Cc: Borislav Petkov <[email protected]>
  18. Cc: Cyrill Gorcunov <[email protected]>
  19. Cc: Linus Torvalds <[email protected]>
  20. Cc: Peter Zijlstra <[email protected]>
  21. Cc: Thomas Gleixner <[email protected]>
  22. Cc: [email protected]
  23. Link: http://lkml.kernel.org/r/[email protected]
  24. Signed-off-by: Ingo Molnar <[email protected]>
  25. (cherry picked from commit 4375c29985f155d7eb2346615d84e62d1b673682)
  26. Signed-off-by: Andy Whitcroft <[email protected]>
  27. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  28. (cherry picked from commit a883ee7f3c1dc64a8c946543ac598399353d1b03)
  29. Signed-off-by: Fabian Grünbichler <[email protected]>
  30. ---
  31. arch/x86/kernel/head_64.S | 11 ++++++-----
  32. 1 file changed, 6 insertions(+), 5 deletions(-)
  33. diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
  34. index d081bc7a027d..12daaa0b187f 100644
  35. --- a/arch/x86/kernel/head_64.S
  36. +++ b/arch/x86/kernel/head_64.S
  37. @@ -37,11 +37,12 @@
  38. *
  39. */
  40. -#define p4d_index(x) (((x) >> P4D_SHIFT) & (PTRS_PER_P4D-1))
  41. #define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
  42. +#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH)
  43. PGD_PAGE_OFFSET = pgd_index(__PAGE_OFFSET_BASE)
  44. PGD_START_KERNEL = pgd_index(__START_KERNEL_map)
  45. +#endif
  46. L3_START_KERNEL = pud_index(__START_KERNEL_map)
  47. .text
  48. @@ -348,10 +349,7 @@ NEXT_PAGE(early_dynamic_pgts)
  49. .data
  50. -#ifndef CONFIG_XEN
  51. -NEXT_PAGE(init_top_pgt)
  52. - .fill 512,8,0
  53. -#else
  54. +#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH)
  55. NEXT_PAGE(init_top_pgt)
  56. .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE
  57. .org init_top_pgt + PGD_PAGE_OFFSET*8, 0
  58. @@ -368,6 +366,9 @@ NEXT_PAGE(level2_ident_pgt)
  59. * Don't set NX because code runs from these pages.
  60. */
  61. PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD)
  62. +#else
  63. +NEXT_PAGE(init_top_pgt)
  64. + .fill 512,8,0
  65. #endif
  66. #ifdef CONFIG_X86_5LEVEL
  67. --
  68. 2.14.2