0213-x86-dumpstack-Indicate-in-Oops-whether-PTI-is-config.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From c7ef01f56951b1c876069387c44e11575288f3d2 Mon Sep 17 00:00:00 2001
  2. From: Vlastimil Babka <[email protected]>
  3. Date: Tue, 19 Dec 2017 22:33:46 +0100
  4. Subject: [PATCH 213/232] x86/dumpstack: Indicate in Oops whether PTI is
  5. configured and enabled
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. CONFIG_PAGE_TABLE_ISOLATION is relatively new and intrusive feature that may
  11. still have some corner cases which could take some time to manifest and be
  12. fixed. It would be useful to have Oops messages indicate whether it was
  13. enabled for building the kernel, and whether it was disabled during boot.
  14. Example of fully enabled:
  15. Oops: 0001 [#1] SMP PTI
  16. Example of enabled during build, but disabled during boot:
  17. Oops: 0001 [#1] SMP NOPTI
  18. We can decide to remove this after the feature has been tested in the field
  19. long enough.
  20. [ tglx: Made it use boot_cpu_has() as requested by Borislav ]
  21. Signed-off-by: Vlastimil Babka <[email protected]>
  22. Signed-off-by: Thomas Gleixner <[email protected]>
  23. Reviewed-by: Eduardo Valentin <[email protected]>
  24. Acked-by: Dave Hansen <[email protected]>
  25. Cc: Andy Lutomirski <[email protected]>
  26. Cc: Andy Lutomirsky <[email protected]>
  27. Cc: Boris Ostrovsky <[email protected]>
  28. Cc: Borislav Petkov <[email protected]>
  29. Cc: Brian Gerst <[email protected]>
  30. Cc: Dave Hansen <[email protected]>
  31. Cc: David Laight <[email protected]>
  32. Cc: Denys Vlasenko <[email protected]>
  33. Cc: Greg KH <[email protected]>
  34. Cc: H. Peter Anvin <[email protected]>
  35. Cc: Josh Poimboeuf <[email protected]>
  36. Cc: Juergen Gross <[email protected]>
  37. Cc: Linus Torvalds <[email protected]>
  38. Cc: Peter Zijlstra <[email protected]>
  39. Cc: Will Deacon <[email protected]>
  40. Cc: [email protected]
  41. Cc: [email protected]
  42. Cc: [email protected]
  43. Cc: [email protected]
  44. Cc: [email protected]
  45. Cc: [email protected]
  46. Signed-off-by: Ingo Molnar <[email protected]>
  47. (cherry picked from commit 5f26d76c3fd67c48806415ef8b1116c97beff8ba)
  48. Signed-off-by: Andy Whitcroft <[email protected]>
  49. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  50. (cherry picked from commit 7edb91fcc96589ad6b80446ec3835f83ffabb710)
  51. Signed-off-by: Fabian Grünbichler <[email protected]>
  52. ---
  53. arch/x86/kernel/dumpstack.c | 6 ++++--
  54. 1 file changed, 4 insertions(+), 2 deletions(-)
  55. diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
  56. index 2bdeb983b9d8..19a936e9b259 100644
  57. --- a/arch/x86/kernel/dumpstack.c
  58. +++ b/arch/x86/kernel/dumpstack.c
  59. @@ -298,11 +298,13 @@ int __die(const char *str, struct pt_regs *regs, long err)
  60. unsigned long sp;
  61. #endif
  62. printk(KERN_DEFAULT
  63. - "%s: %04lx [#%d]%s%s%s%s\n", str, err & 0xffff, ++die_counter,
  64. + "%s: %04lx [#%d]%s%s%s%s%s\n", str, err & 0xffff, ++die_counter,
  65. IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
  66. IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
  67. debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
  68. - IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "");
  69. + IS_ENABLED(CONFIG_KASAN) ? " KASAN" : "",
  70. + IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION) ?
  71. + (boot_cpu_has(X86_FEATURE_PTI) ? " PTI" : " NOPTI") : "");
  72. if (notify_die(DIE_OOPS, str, regs, err,
  73. current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
  74. --
  75. 2.14.2