0254-x86-tboot-Unbreak-tboot-with-PTI-enabled.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Dave Hansen <[email protected]>
  3. Date: Sat, 6 Jan 2018 18:41:14 +0100
  4. Subject: [PATCH] x86/tboot: Unbreak tboot with PTI enabled
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5754
  9. This is another case similar to what EFI does: create a new set of
  10. page tables, map some code at a low address, and jump to it. PTI
  11. mistakes this low address for userspace and mistakenly marks it
  12. non-executable in an effort to make it unusable for userspace.
  13. Undo the poison to allow execution.
  14. Fixes: 385ce0ea4c07 ("x86/mm/pti: Add Kconfig")
  15. Signed-off-by: Dave Hansen <[email protected]>
  16. Signed-off-by: Andrea Arcangeli <[email protected]>
  17. Signed-off-by: Thomas Gleixner <[email protected]>
  18. Cc: Alan Cox <[email protected]>
  19. Cc: Tim Chen <[email protected]>
  20. Cc: Jon Masters <[email protected]>
  21. Cc: Dave Hansen <[email protected]>
  22. Cc: Andi Kleen <[email protected]>
  23. Cc: Jeff Law <[email protected]>
  24. Cc: Paolo Bonzini <[email protected]>
  25. Cc: Linus Torvalds <[email protected]>
  26. Cc: Greg Kroah-Hartman <[email protected]>
  27. Cc: David" <[email protected]>
  28. Cc: Nick Clifton <[email protected]>
  29. Cc: [email protected]
  30. Link: https://lkml.kernel.org/r/[email protected]
  31. (cherry picked from commit 262b6b30087246abf09d6275eb0c0dc421bcbe38)
  32. Signed-off-by: Andy Whitcroft <[email protected]>
  33. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  34. (cherry picked from commit f03e9108405491791f0b883a2d95e2620ddfce64)
  35. Signed-off-by: Fabian Grünbichler <[email protected]>
  36. ---
  37. arch/x86/kernel/tboot.c | 1 +
  38. 1 file changed, 1 insertion(+)
  39. diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
  40. index a4eb27918ceb..75869a4b6c41 100644
  41. --- a/arch/x86/kernel/tboot.c
  42. +++ b/arch/x86/kernel/tboot.c
  43. @@ -127,6 +127,7 @@ static int map_tboot_page(unsigned long vaddr, unsigned long pfn,
  44. p4d = p4d_alloc(&tboot_mm, pgd, vaddr);
  45. if (!p4d)
  46. return -1;
  47. + pgd->pgd &= ~_PAGE_NX;
  48. pud = pud_alloc(&tboot_mm, p4d, vaddr);
  49. if (!pud)
  50. return -1;
  51. --
  52. 2.14.2