0063-x86-unwind-Rename-unwinder-config-options-to-CONFIG_.patch 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. From dcc61cf4d482d478979471795935733845fe757e Mon Sep 17 00:00:00 2001
  2. From: Josh Poimboeuf <[email protected]>
  3. Date: Fri, 13 Oct 2017 15:02:00 -0500
  4. Subject: [PATCH 063/242] x86/unwind: Rename unwinder config options to
  5. 'CONFIG_UNWINDER_*'
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. Rename the unwinder config options from:
  11. CONFIG_ORC_UNWINDER
  12. CONFIG_FRAME_POINTER_UNWINDER
  13. CONFIG_GUESS_UNWINDER
  14. to:
  15. CONFIG_UNWINDER_ORC
  16. CONFIG_UNWINDER_FRAME_POINTER
  17. CONFIG_UNWINDER_GUESS
  18. ... in order to give them a more logical config namespace.
  19. Suggested-by: Ingo Molnar <[email protected]>
  20. Signed-off-by: Josh Poimboeuf <[email protected]>
  21. Cc: Linus Torvalds <[email protected]>
  22. Cc: Peter Zijlstra <[email protected]>
  23. Cc: Thomas Gleixner <[email protected]>
  24. Link: http://lkml.kernel.org/r/73972fc7e2762e91912c6b9584582703d6f1b8cc.1507924831.git.jpoimboe@redhat.com
  25. Signed-off-by: Ingo Molnar <[email protected]>
  26. (cherry picked from commit 11af847446ed0d131cf24d16a7ef3d5ea7a49554)
  27. Signed-off-by: Andy Whitcroft <[email protected]>
  28. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  29. (cherry picked from commit 27ab2a240a797b073ce63385b1d5db06e44fc3ae)
  30. Signed-off-by: Fabian Grünbichler <[email protected]>
  31. ---
  32. Documentation/x86/orc-unwinder.txt | 2 +-
  33. Makefile | 4 ++--
  34. arch/x86/kernel/Makefile | 6 +++---
  35. scripts/Makefile.build | 2 +-
  36. arch/x86/include/asm/module.h | 2 +-
  37. arch/x86/include/asm/unwind.h | 8 ++++----
  38. include/asm-generic/vmlinux.lds.h | 2 +-
  39. arch/x86/Kconfig | 2 +-
  40. arch/x86/Kconfig.debug | 10 +++++-----
  41. arch/x86/configs/tiny.config | 4 ++--
  42. arch/x86/configs/x86_64_defconfig | 2 +-
  43. lib/Kconfig.debug | 2 +-
  44. 12 files changed, 23 insertions(+), 23 deletions(-)
  45. diff --git a/Documentation/x86/orc-unwinder.txt b/Documentation/x86/orc-unwinder.txt
  46. index af0c9a4c65a6..cd4b29be29af 100644
  47. --- a/Documentation/x86/orc-unwinder.txt
  48. +++ b/Documentation/x86/orc-unwinder.txt
  49. @@ -4,7 +4,7 @@ ORC unwinder
  50. Overview
  51. --------
  52. -The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
  53. +The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is
  54. similar in concept to a DWARF unwinder. The difference is that the
  55. format of the ORC data is much simpler than DWARF, which in turn allows
  56. the ORC unwinder to be much simpler and faster.
  57. diff --git a/Makefile b/Makefile
  58. index 490ce18685ea..b740e3dc9ff8 100644
  59. --- a/Makefile
  60. +++ b/Makefile
  61. @@ -965,8 +965,8 @@ ifdef CONFIG_STACK_VALIDATION
  62. ifeq ($(has_libelf),1)
  63. objtool_target := tools/objtool FORCE
  64. else
  65. - ifdef CONFIG_ORC_UNWINDER
  66. - $(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
  67. + ifdef CONFIG_UNWINDER_ORC
  68. + $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
  69. else
  70. $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
  71. endif
  72. diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
  73. index e2315aecc441..5bf0d5a473b4 100644
  74. --- a/arch/x86/kernel/Makefile
  75. +++ b/arch/x86/kernel/Makefile
  76. @@ -125,9 +125,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
  77. obj-$(CONFIG_TRACING) += tracepoint.o
  78. obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
  79. -obj-$(CONFIG_ORC_UNWINDER) += unwind_orc.o
  80. -obj-$(CONFIG_FRAME_POINTER_UNWINDER) += unwind_frame.o
  81. -obj-$(CONFIG_GUESS_UNWINDER) += unwind_guess.o
  82. +obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o
  83. +obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o
  84. +obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
  85. ###
  86. # 64 bit specific files
  87. diff --git a/scripts/Makefile.build b/scripts/Makefile.build
  88. index ab2c8ef43cdb..436005392047 100644
  89. --- a/scripts/Makefile.build
  90. +++ b/scripts/Makefile.build
  91. @@ -258,7 +258,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1)
  92. __objtool_obj := $(objtree)/tools/objtool/objtool
  93. -objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check)
  94. +objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check)
  95. ifndef CONFIG_FRAME_POINTER
  96. objtool_args += --no-fp
  97. diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
  98. index 9eb7c718aaf8..9f05a1002aa9 100644
  99. --- a/arch/x86/include/asm/module.h
  100. +++ b/arch/x86/include/asm/module.h
  101. @@ -5,7 +5,7 @@
  102. #include <asm/orc_types.h>
  103. struct mod_arch_specific {
  104. -#ifdef CONFIG_ORC_UNWINDER
  105. +#ifdef CONFIG_UNWINDER_ORC
  106. unsigned int num_orcs;
  107. int *orc_unwind_ip;
  108. struct orc_entry *orc_unwind;
  109. diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
  110. index e9f793e2df7a..35d67dc7b69f 100644
  111. --- a/arch/x86/include/asm/unwind.h
  112. +++ b/arch/x86/include/asm/unwind.h
  113. @@ -12,11 +12,11 @@ struct unwind_state {
  114. struct task_struct *task;
  115. int graph_idx;
  116. bool error;
  117. -#if defined(CONFIG_ORC_UNWINDER)
  118. +#if defined(CONFIG_UNWINDER_ORC)
  119. bool signal, full_regs;
  120. unsigned long sp, bp, ip;
  121. struct pt_regs *regs;
  122. -#elif defined(CONFIG_FRAME_POINTER_UNWINDER)
  123. +#elif defined(CONFIG_UNWINDER_FRAME_POINTER)
  124. bool got_irq;
  125. unsigned long *bp, *orig_sp, ip;
  126. struct pt_regs *regs;
  127. @@ -50,7 +50,7 @@ void unwind_start(struct unwind_state *state, struct task_struct *task,
  128. __unwind_start(state, task, regs, first_frame);
  129. }
  130. -#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER)
  131. +#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
  132. static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
  133. {
  134. if (unwind_done(state))
  135. @@ -65,7 +65,7 @@ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
  136. }
  137. #endif
  138. -#ifdef CONFIG_ORC_UNWINDER
  139. +#ifdef CONFIG_UNWINDER_ORC
  140. void unwind_init(void);
  141. void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
  142. void *orc, size_t orc_size);
  143. diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
  144. index 9fdb54a95976..e71e42432360 100644
  145. --- a/include/asm-generic/vmlinux.lds.h
  146. +++ b/include/asm-generic/vmlinux.lds.h
  147. @@ -686,7 +686,7 @@
  148. #define BUG_TABLE
  149. #endif
  150. -#ifdef CONFIG_ORC_UNWINDER
  151. +#ifdef CONFIG_UNWINDER_ORC
  152. #define ORC_UNWIND_TABLE \
  153. . = ALIGN(4); \
  154. .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
  155. diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
  156. index 3a0b8cb57caf..bf9f03740c30 100644
  157. --- a/arch/x86/Kconfig
  158. +++ b/arch/x86/Kconfig
  159. @@ -168,7 +168,7 @@ config X86
  160. select HAVE_PERF_REGS
  161. select HAVE_PERF_USER_STACK_DUMP
  162. select HAVE_REGS_AND_STACK_ACCESS_API
  163. - select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
  164. + select HAVE_RELIABLE_STACKTRACE if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION
  165. select HAVE_STACK_VALIDATION if X86_64
  166. select HAVE_SYSCALL_TRACEPOINTS
  167. select HAVE_UNSTABLE_SCHED_CLOCK
  168. diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
  169. index c441b5d65ec8..5435a943f894 100644
  170. --- a/arch/x86/Kconfig.debug
  171. +++ b/arch/x86/Kconfig.debug
  172. @@ -358,13 +358,13 @@ config PUNIT_ATOM_DEBUG
  173. choice
  174. prompt "Choose kernel unwinder"
  175. - default FRAME_POINTER_UNWINDER
  176. + default UNWINDER_FRAME_POINTER
  177. ---help---
  178. This determines which method will be used for unwinding kernel stack
  179. traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
  180. livepatch, lockdep, and more.
  181. -config FRAME_POINTER_UNWINDER
  182. +config UNWINDER_FRAME_POINTER
  183. bool "Frame pointer unwinder"
  184. select FRAME_POINTER
  185. ---help---
  186. @@ -379,7 +379,7 @@ config FRAME_POINTER_UNWINDER
  187. consistency model, as this is currently the only way to get a
  188. reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
  189. -config ORC_UNWINDER
  190. +config UNWINDER_ORC
  191. bool "ORC unwinder"
  192. depends on X86_64
  193. select STACK_VALIDATION
  194. @@ -396,7 +396,7 @@ config ORC_UNWINDER
  195. Enabling this option will increase the kernel's runtime memory usage
  196. by roughly 2-4MB, depending on your kernel config.
  197. -config GUESS_UNWINDER
  198. +config UNWINDER_GUESS
  199. bool "Guess unwinder"
  200. depends on EXPERT
  201. ---help---
  202. @@ -411,7 +411,7 @@ config GUESS_UNWINDER
  203. endchoice
  204. config FRAME_POINTER
  205. - depends on !ORC_UNWINDER && !GUESS_UNWINDER
  206. + depends on !UNWINDER_ORC && !UNWINDER_GUESS
  207. bool
  208. endmenu
  209. diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
  210. index 550cd5012b73..66c9e2aab16c 100644
  211. --- a/arch/x86/configs/tiny.config
  212. +++ b/arch/x86/configs/tiny.config
  213. @@ -1,5 +1,5 @@
  214. CONFIG_NOHIGHMEM=y
  215. # CONFIG_HIGHMEM4G is not set
  216. # CONFIG_HIGHMEM64G is not set
  217. -CONFIG_GUESS_UNWINDER=y
  218. -# CONFIG_FRAME_POINTER_UNWINDER is not set
  219. +CONFIG_UNWINDER_GUESS=y
  220. +# CONFIG_UNWINDER_FRAME_POINTER is not set
  221. diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
  222. index eb65c248708d..e32fc1f274d8 100644
  223. --- a/arch/x86/configs/x86_64_defconfig
  224. +++ b/arch/x86/configs/x86_64_defconfig
  225. @@ -299,7 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
  226. # CONFIG_DEBUG_RODATA_TEST is not set
  227. CONFIG_DEBUG_BOOT_PARAMS=y
  228. CONFIG_OPTIMIZE_INLINING=y
  229. -CONFIG_ORC_UNWINDER=y
  230. +CONFIG_UNWINDER_ORC=y
  231. CONFIG_SECURITY=y
  232. CONFIG_SECURITY_NETWORK=y
  233. CONFIG_SECURITY_SELINUX=y
  234. diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
  235. index 0b4d1b3880b0..4f6ca5f60f7e 100644
  236. --- a/lib/Kconfig.debug
  237. +++ b/lib/Kconfig.debug
  238. @@ -375,7 +375,7 @@ config STACK_VALIDATION
  239. that runtime stack traces are more reliable.
  240. This is also a prerequisite for generation of ORC unwind data, which
  241. - is needed for CONFIG_ORC_UNWINDER.
  242. + is needed for CONFIG_UNWINDER_ORC.
  243. For more information, see
  244. tools/objtool/Documentation/stack-validation.txt.
  245. --
  246. 2.14.2