0164-x86-mm-dump_pagetables-Check-PAGE_PRESENT-for-real.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From d54a0500d55a2856efdea3b427e91d8fcf74ca63 Mon Sep 17 00:00:00 2001
  2. From: Thomas Gleixner <[email protected]>
  3. Date: Sat, 16 Dec 2017 01:14:39 +0100
  4. Subject: [PATCH 164/232] x86/mm/dump_pagetables: Check PAGE_PRESENT for real
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5754
  9. The check for a present page in printk_prot():
  10. if (!pgprot_val(prot)) {
  11. /* Not present */
  12. is bogus. If a PTE is set to PAGE_NONE then the pgprot_val is not zero and
  13. the entry is decoded in bogus ways, e.g. as RX GLB. That is confusing when
  14. analyzing mapping correctness. Check for the present bit to make an
  15. informed decision.
  16. Signed-off-by: Thomas Gleixner <[email protected]>
  17. Cc: Andy Lutomirski <[email protected]>
  18. Cc: Borislav Petkov <[email protected]>
  19. Cc: Dave Hansen <[email protected]>
  20. Cc: H. Peter Anvin <[email protected]>
  21. Cc: Josh Poimboeuf <[email protected]>
  22. Cc: Juergen Gross <[email protected]>
  23. Cc: Linus Torvalds <[email protected]>
  24. Cc: Peter Zijlstra <[email protected]>
  25. Cc: [email protected]
  26. Signed-off-by: Ingo Molnar <[email protected]>
  27. (cherry picked from commit c05344947b37f7cda726e802457370bc6eac4d26)
  28. Signed-off-by: Andy Whitcroft <[email protected]>
  29. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  30. (cherry picked from commit d902780eaea12f23b50be4ff00f8df6157c30e4a)
  31. Signed-off-by: Fabian Grünbichler <[email protected]>
  32. ---
  33. arch/x86/mm/dump_pagetables.c | 2 +-
  34. 1 file changed, 1 insertion(+), 1 deletion(-)
  35. diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
  36. index 0470826d2bdc..91aa41c5e0dd 100644
  37. --- a/arch/x86/mm/dump_pagetables.c
  38. +++ b/arch/x86/mm/dump_pagetables.c
  39. @@ -140,7 +140,7 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
  40. static const char * const level_name[] =
  41. { "cr3", "pgd", "pud", "pmd", "pte" };
  42. - if (!pgprot_val(prot)) {
  43. + if (!(pr & _PAGE_PRESENT)) {
  44. /* Not present */
  45. pt_dump_cont_printf(m, dmsg, " ");
  46. } else {
  47. --
  48. 2.14.2