History

objtool: Add CONFIG_OBJTOOL

Now that stack validation is an optional feature of objtool, add CONFIG_OBJTOOL and replace most usages of CONFIG_STACK_VALIDATION with it. CONFIG_STACK_VALIDATION can now be considered to be frame-pointer specific. CONFIG_UNWINDER_ORC is already inherently valid for live patching, so no need to "validate" it.

Josh Poimboeuf committed 4 years ago

Commit 03f16cd1 parent c2bdd6117 files · +73 −57Browse files

Unified · Split

17 files
  1. Makefile +1 −1
  2. arch/Kconfig +6 −2
  3. arch/x86/Kconfig +11 −7
  4. arch/x86/Kconfig.debug +1 −1
  5. arch/x86/include/asm/jump_label.h +3 −3
  6. arch/x86/kernel/alternative.c +3 −3
  7. include/linux/compiler.h +3 −3
  8. include/linux/instrumentation.h +3 −3
  9. include/linux/objtool.h +3 −3
  10. kernel/trace/Kconfig +1 −0
  11. lib/Kconfig.debug +11 −9
  12. lib/Kconfig.kcsan +2 −1
  13. lib/Kconfig.ubsan +1 −1
  14. scripts/Makefile.build +2 −2
  15. scripts/link-vmlinux.sh +18 −14
  16. scripts/package/builddeb +1 −1
  17. tools/include/linux/objtool.h +3 −3
Makefile+1−1
@@ -1302,7 +1302,7 @@ install: sub_make_done := · 1301 unmodified lines
1302# ---------------------------------------------------------------------------1302# ---------------------------------------------------------------------------
1303# Tools1303# Tools
1304 1304
1305ifdef CONFIG_STACK_VALIDATION1305ifdef CONFIG_OBJTOOL
1306prepare: tools/objtool1306prepare: tools/objtool
1307endif1307endif
1308 1308
arch/Kconfig+6−2
@@ -1028,11 +1028,14 @@ config ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT · 1027 unmodified lines
1028 depends on MMU1028 depends on MMU
1029 select ARCH_HAS_ELF_RANDOMIZE1029 select ARCH_HAS_ELF_RANDOMIZE
1030 1030
1031config HAVE_OBJTOOL
1032 bool
1033
1031config HAVE_STACK_VALIDATION1034config HAVE_STACK_VALIDATION
1032 bool1035 bool
1033 help1036 help
1034 Architecture supports the 'objtool check' host tool command, which1037 Architecture supports objtool compile-time frame pointer rule
1035 performs compile-time stack metadata validation.1038 validation.
1036 1039
1037config HAVE_RELIABLE_STACKTRACE1040config HAVE_RELIABLE_STACKTRACE
1038 bool1041 bool
@@ -1302,6 +1305,7 @@ config HAVE_STATIC_CALL · 263 unmodified lines
1302config HAVE_STATIC_CALL_INLINE1305config HAVE_STATIC_CALL_INLINE
1303 bool1306 bool
1304 depends on HAVE_STATIC_CALL1307 depends on HAVE_STATIC_CALL
1308 select OBJTOOL
1305 1309
1306config HAVE_PREEMPT_DYNAMIC1310config HAVE_PREEMPT_DYNAMIC
1307 bool1311 bool
arch/x86/Kconfig+11−7
@@ -188,7 +188,7 @@ config X86 · 187 unmodified lines
188 select HAVE_CONTEXT_TRACKING if X86_64188 select HAVE_CONTEXT_TRACKING if X86_64
189 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING189 select HAVE_CONTEXT_TRACKING_OFFSTACK if HAVE_CONTEXT_TRACKING
190 select HAVE_C_RECORDMCOUNT190 select HAVE_C_RECORDMCOUNT
191 select HAVE_OBJTOOL_MCOUNT if STACK_VALIDATION191 select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL
192 select HAVE_BUILDTIME_MCOUNT_SORT192 select HAVE_BUILDTIME_MCOUNT_SORT
193 select HAVE_DEBUG_KMEMLEAK193 select HAVE_DEBUG_KMEMLEAK
194 select HAVE_DMA_CONTIGUOUS194 select HAVE_DMA_CONTIGUOUS
@@ -231,6 +231,7 @@ config X86 · 36 unmodified lines
231 select HAVE_MOVE_PMD231 select HAVE_MOVE_PMD
232 select HAVE_MOVE_PUD232 select HAVE_MOVE_PUD
233 select HAVE_NMI233 select HAVE_NMI
234 select HAVE_OBJTOOL if X86_64
234 select HAVE_OPTPROBES235 select HAVE_OPTPROBES
235 select HAVE_PCSPKR_PLATFORM236 select HAVE_PCSPKR_PLATFORM
236 select HAVE_PERF_EVENTS237 select HAVE_PERF_EVENTS
@@ -239,17 +240,17 @@ config X86 · 2 unmodified lines
239 select HAVE_PCI240 select HAVE_PCI
240 select HAVE_PERF_REGS241 select HAVE_PERF_REGS
241 select HAVE_PERF_USER_STACK_DUMP242 select HAVE_PERF_USER_STACK_DUMP
242 select MMU_GATHER_RCU_TABLE_FREE if PARAVIRT243 select MMU_GATHER_RCU_TABLE_FREE if PARAVIRT
243 select HAVE_POSIX_CPU_TIMERS_TASK_WORK244 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
244 select HAVE_REGS_AND_STACK_ACCESS_API245 select HAVE_REGS_AND_STACK_ACCESS_API
245 select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION246 select HAVE_RELIABLE_STACKTRACE if UNWINDER_ORC || STACK_VALIDATION
246 select HAVE_FUNCTION_ARG_ACCESS_API247 select HAVE_FUNCTION_ARG_ACCESS_API
247 select HAVE_SETUP_PER_CPU_AREA248 select HAVE_SETUP_PER_CPU_AREA
248 select HAVE_SOFTIRQ_ON_OWN_STACK249 select HAVE_SOFTIRQ_ON_OWN_STACK
249 select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR250 select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR
250 select HAVE_STACK_VALIDATION if X86_64251 select HAVE_STACK_VALIDATION if HAVE_OBJTOOL
251 select HAVE_STATIC_CALL252 select HAVE_STATIC_CALL
252 select HAVE_STATIC_CALL_INLINE if HAVE_STACK_VALIDATION253 select HAVE_STATIC_CALL_INLINE if HAVE_OBJTOOL
253 select HAVE_PREEMPT_DYNAMIC_CALL254 select HAVE_PREEMPT_DYNAMIC_CALL
254 select HAVE_RSEQ255 select HAVE_RSEQ
255 select HAVE_SYSCALL_TRACEPOINTS256 select HAVE_SYSCALL_TRACEPOINTS
@@ -268,7 +269,6 @@ config X86 · 12 unmodified lines
268 select RTC_MC146818_LIB269 select RTC_MC146818_LIB
269 select SPARSE_IRQ270 select SPARSE_IRQ
270 select SRCU271 select SRCU
271 select STACK_VALIDATION if HAVE_STACK_VALIDATION && (HAVE_STATIC_CALL_INLINE || RETPOLINE)
272 select SYSCTL_EXCEPTION_TRACE272 select SYSCTL_EXCEPTION_TRACE
273 select THREAD_INFO_IN_TASK273 select THREAD_INFO_IN_TASK
274 select TRACE_IRQFLAGS_SUPPORT274 select TRACE_IRQFLAGS_SUPPORT
@@ -459,6 +459,7 @@ config GOLDFISH · 184 unmodified lines
459 459
460config RETPOLINE460config RETPOLINE
461 bool "Avoid speculative indirect branches in kernel"461 bool "Avoid speculative indirect branches in kernel"
462 select OBJTOOL if HAVE_OBJTOOL
462 default y463 default y
463 help464 help
464 Compile kernel with the retpoline compiler options to guard against465 Compile kernel with the retpoline compiler options to guard against
@@ -472,6 +473,7 @@ config CC_HAS_SLS · 7 unmodified lines
472config SLS473config SLS
473 bool "Mitigate Straight-Line-Speculation"474 bool "Mitigate Straight-Line-Speculation"
474 depends on CC_HAS_SLS && X86_64475 depends on CC_HAS_SLS && X86_64
476 select OBJTOOL if HAVE_OBJTOOL
475 default n477 default n
476 help478 help
477 Compile the kernel with straight-line-speculation options to guard479 Compile the kernel with straight-line-speculation options to guard
@@ -1819,6 +1821,7 @@ config ARCH_RANDOM · 1341 unmodified lines
1819config X86_SMAP1821config X86_SMAP
1820 def_bool y1822 def_bool y
1821 prompt "Supervisor Mode Access Prevention" if EXPERT1823 prompt "Supervisor Mode Access Prevention" if EXPERT
1824 select OBJTOOL if HAVE_OBJTOOL
1822 help1825 help
1823 Supervisor Mode Access Prevention (SMAP) is a security1826 Supervisor Mode Access Prevention (SMAP) is a security
1824 feature in newer Intel processors. There is a small1827 feature in newer Intel processors. There is a small
@@ -1855,9 +1858,10 @@ config CC_HAS_IBT · 30 unmodified lines
1855config X86_KERNEL_IBT1858config X86_KERNEL_IBT
1856 prompt "Indirect Branch Tracking"1859 prompt "Indirect Branch Tracking"
1857 bool1860 bool
1858 depends on X86_64 && CC_HAS_IBT && STACK_VALIDATION1861 depends on X86_64 && CC_HAS_IBT && HAVE_OBJTOOL
1859 # https://github.com/llvm/llvm-project/commit/9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f1862 # https://github.com/llvm/llvm-project/commit/9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f
1860 depends on !LD_IS_LLD || LLD_VERSION >= 1400001863 depends on !LD_IS_LLD || LLD_VERSION >= 140000
1864 select OBJTOOL
1861 help1865 help
1862 Build the kernel with support for Indirect Branch Tracking, a1866 Build the kernel with support for Indirect Branch Tracking, a
1863 hardware support course-grain forward-edge Control Flow Integrity1867 hardware support course-grain forward-edge Control Flow Integrity
arch/x86/Kconfig.debug+1−1
@@ -237,7 +237,7 @@ choice · 236 unmodified lines
237config UNWINDER_ORC237config UNWINDER_ORC
238 bool "ORC unwinder"238 bool "ORC unwinder"
239 depends on X86_64239 depends on X86_64
240 select STACK_VALIDATION240 select OBJTOOL
241 help241 help
242 This option enables the ORC (Oops Rewind Capability) unwinder for242 This option enables the ORC (Oops Rewind Capability) unwinder for
243 unwinding kernel stack traces. It uses a custom data format which is243 unwinding kernel stack traces. It uses a custom data format which is
arch/x86/include/asm/jump_label.h+3−3
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 _ASM_PTR "%c0 + %c1 - .\n\t" \20 _ASM_PTR "%c0 + %c1 - .\n\t" \
21 ".popsection \n\t"21 ".popsection \n\t"
22 22
23#ifdef CONFIG_STACK_VALIDATION23#ifdef CONFIG_OBJTOOL
24 24
25static __always_inline bool arch_static_branch(struct static_key *key, bool branch)25static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
26{26{
@@ -34,7 +34,7 @@ l_yes: · 7 unmodified lines
34 return true;34 return true;
35}35}
36 36
37#else37#else /* !CONFIG_OBJTOOL */
38 38
39static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch)39static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch)
40{40{
@@ -48,7 +48,7 @@ l_yes: · 7 unmodified lines
48 return true;48 return true;
49}49}
50 50
51#endif /* STACK_VALIDATION */51#endif /* CONFIG_OBJTOOL */
52 52
53static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch)53static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch)
54{54{
arch/x86/kernel/alternative.c+3−3
@@ -338,7 +338,7 @@ next: · 337 unmodified lines
338 }338 }
339}339}
340 340
341#if defined(CONFIG_RETPOLINE) && defined(CONFIG_STACK_VALIDATION)341#if defined(CONFIG_RETPOLINE) && defined(CONFIG_OBJTOOL)
342 342
343/*343/*
344 * CALL/JMP *%\reg344 * CALL/JMP *%\reg
@@ -507,11 +507,11 @@ void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) · 162 unmodified lines
507 }507 }
508}508}
509 509
510#else /* !RETPOLINES || !CONFIG_STACK_VALIDATION */510#else /* !CONFIG_RETPOLINE || !CONFIG_OBJTOOL */
511 511
512void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }512void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }
513 513
514#endif /* CONFIG_RETPOLINE && CONFIG_STACK_VALIDATION */514#endif /* CONFIG_RETPOLINE && CONFIG_OBJTOOL */
515 515
516#ifdef CONFIG_X86_KERNEL_IBT516#ifdef CONFIG_X86_KERNEL_IBT
517 517
include/linux/compiler.h+3−3
@@ -109,7 +109,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 108 unmodified lines
109#endif109#endif
110 110
111/* Unreachable code */111/* Unreachable code */
112#ifdef CONFIG_STACK_VALIDATION112#ifdef CONFIG_OBJTOOL
113/*113/*
114 * These macros help objtool understand GCC code flow for unreachable code.114 * These macros help objtool understand GCC code flow for unreachable code.
115 * The __COUNTER__ based labels are a hack to make each instance of the macros115 * The __COUNTER__ based labels are a hack to make each instance of the macros
@@ -128,10 +128,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 12 unmodified lines
128/* Annotate a C jump table to allow objtool to follow the code flow */128/* Annotate a C jump table to allow objtool to follow the code flow */
129#define __annotate_jump_table __section(".rodata..c_jump_table")129#define __annotate_jump_table __section(".rodata..c_jump_table")
130 130
131#else131#else /* !CONFIG_OBJTOOL */
132#define annotate_unreachable()132#define annotate_unreachable()
133#define __annotate_jump_table133#define __annotate_jump_table
134#endif134#endif /* CONFIG_OBJTOOL */
135 135
136#ifndef unreachable136#ifndef unreachable
137# define unreachable() do { \137# define unreachable() do { \
include/linux/instrumentation.h+3−3
@@ -2,7 +2,7 @@ · 1 unmodified line
2#ifndef __LINUX_INSTRUMENTATION_H2#ifndef __LINUX_INSTRUMENTATION_H
3#define __LINUX_INSTRUMENTATION_H3#define __LINUX_INSTRUMENTATION_H
4 4
5#if defined(CONFIG_DEBUG_ENTRY) && defined(CONFIG_STACK_VALIDATION)5#ifdef CONFIG_VMLINUX_VALIDATION
6 6
7#include <linux/stringify.h>7#include <linux/stringify.h>
8 8
@@ -53,9 +53,9 @@ · 44 unmodified lines
53 ".popsection\n\t" : : "i" (c)); \53 ".popsection\n\t" : : "i" (c)); \
54})54})
55#define instrumentation_end() __instrumentation_end(__COUNTER__)55#define instrumentation_end() __instrumentation_end(__COUNTER__)
56#else56#else /* !CONFIG_VMLINUX_VALIDATION */
57# define instrumentation_begin() do { } while(0)57# define instrumentation_begin() do { } while(0)
58# define instrumentation_end() do { } while(0)58# define instrumentation_end() do { } while(0)
59#endif59#endif /* CONFIG_VMLINUX_VALIDATION */
60 60
61#endif /* __LINUX_INSTRUMENTATION_H */61#endif /* __LINUX_INSTRUMENTATION_H */
include/linux/objtool.h+3−3
@@ -38,7 +38,7 @@ struct unwind_hint { · 37 unmodified lines
38#define UNWIND_HINT_TYPE_REGS_PARTIAL 238#define UNWIND_HINT_TYPE_REGS_PARTIAL 2
39#define UNWIND_HINT_TYPE_FUNC 339#define UNWIND_HINT_TYPE_FUNC 3
40 40
41#ifdef CONFIG_STACK_VALIDATION41#ifdef CONFIG_OBJTOOL
42 42
43#ifndef __ASSEMBLY__43#ifndef __ASSEMBLY__
44 44
@@ -157,7 +157,7 @@ struct unwind_hint { · 112 unmodified lines
157 157
158#endif /* __ASSEMBLY__ */158#endif /* __ASSEMBLY__ */
159 159
160#else /* !CONFIG_STACK_VALIDATION */160#else /* !CONFIG_OBJTOOL */
161 161
162#ifndef __ASSEMBLY__162#ifndef __ASSEMBLY__
163 163
@@ -179,6 +179,6 @@ struct unwind_hint { · 15 unmodified lines
179.endm179.endm
180#endif180#endif
181 181
182#endif /* CONFIG_STACK_VALIDATION */182#endif /* CONFIG_OBJTOOL */
183 183
184#endif /* _LINUX_OBJTOOL_H */184#endif /* _LINUX_OBJTOOL_H */
kernel/trace/Kconfig+1−0
@@ -728,6 +728,7 @@ config FTRACE_MCOUNT_USE_OBJTOOL · 727 unmodified lines
728 depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY728 depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
729 depends on !FTRACE_MCOUNT_USE_CC729 depends on !FTRACE_MCOUNT_USE_CC
730 depends on FTRACE_MCOUNT_RECORD730 depends on FTRACE_MCOUNT_RECORD
731 select OBJTOOL
731 732
732config FTRACE_MCOUNT_USE_RECORDMCOUNT733config FTRACE_MCOUNT_USE_RECORDMCOUNT
733 def_bool y734 def_bool y
lib/Kconfig.debug+11−9
@@ -485,24 +485,25 @@ config FRAME_POINTER · 484 unmodified lines
485 larger and slower, but it gives very useful debugging information485 larger and slower, but it gives very useful debugging information
486 in case of kernel bugs. (precise oopses/stacktraces/warnings)486 in case of kernel bugs. (precise oopses/stacktraces/warnings)
487 487
488config OBJTOOL
489 bool
490
488config STACK_VALIDATION491config STACK_VALIDATION
489 bool "Compile-time stack metadata validation"492 bool "Compile-time stack metadata validation"
490 depends on HAVE_STACK_VALIDATION493 depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER
494 select OBJTOOL
491 default n495 default n
492 help496 help
493 Add compile-time checks to validate stack metadata, including frame497 Validate frame pointer rules at compile-time. This helps ensure that
494 pointers (if CONFIG_FRAME_POINTER is enabled). This helps ensure498 runtime stack traces are more reliable.
495 that runtime stack traces are more reliable.
496
497 This is also a prerequisite for generation of ORC unwind data, which
498 is needed for CONFIG_UNWINDER_ORC.
499 499
500 For more information, see500 For more information, see
501 tools/objtool/Documentation/stack-validation.txt.501 tools/objtool/Documentation/stack-validation.txt.
502 502
503config VMLINUX_VALIDATION503config VMLINUX_VALIDATION
504 bool504 bool
505 depends on STACK_VALIDATION && DEBUG_ENTRY505 depends on HAVE_OBJTOOL && DEBUG_ENTRY
506 select OBJTOOL
506 default y507 default y
507 508
508config VMLINUX_MAP509config VMLINUX_MAP
@@ -2035,10 +2036,11 @@ config KCOV · 1526 unmodified lines
2035 bool "Code coverage for fuzzing"2036 bool "Code coverage for fuzzing"
2036 depends on ARCH_HAS_KCOV2037 depends on ARCH_HAS_KCOV
2037 depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS2038 depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
2038 depends on !ARCH_WANTS_NO_INSTR || STACK_VALIDATION || \2039 depends on !ARCH_WANTS_NO_INSTR || HAVE_OBJTOOL || \
2039 GCC_VERSION >= 120000 || CLANG_VERSION >= 1300002040 GCC_VERSION >= 120000 || CLANG_VERSION >= 130000
2040 select DEBUG_FS2041 select DEBUG_FS
2041 select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC2042 select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
2043 select OBJTOOL if HAVE_OBJTOOL
2042 help2044 help
2043 KCOV exposes kernel code coverage information in a form suitable2045 KCOV exposes kernel code coverage information in a form suitable
2044 for coverage-guided fuzzing (randomized testing).2046 for coverage-guided fuzzing (randomized testing).
lib/Kconfig.kcsan+2−1
@@ -187,7 +187,8 @@ config KCSAN_WEAK_MEMORY · 186 unmodified lines
187 # We can either let objtool nop __tsan_func_{entry,exit}() and builtin187 # We can either let objtool nop __tsan_func_{entry,exit}() and builtin
188 # atomics instrumentation in .noinstr.text, or use a compiler that can188 # atomics instrumentation in .noinstr.text, or use a compiler that can
189 # implement __no_kcsan to really remove all instrumentation.189 # implement __no_kcsan to really remove all instrumentation.
190 depends on STACK_VALIDATION || CC_IS_GCC || CLANG_VERSION >= 140000190 depends on HAVE_OBJTOOL || CC_IS_GCC || CLANG_VERSION >= 140000
191 select OBJTOOL if HAVE_OBJTOOL
191 help192 help
192 Enable support for modeling a subset of weak memory, which allows193 Enable support for modeling a subset of weak memory, which allows
193 detecting a subset of data races due to missing memory barriers.194 detecting a subset of data races due to missing memory barriers.
lib/Kconfig.ubsan+1−1
@@ -94,7 +94,7 @@ config UBSAN_UNREACHABLE · 93 unmodified lines
94 bool "Perform checking for unreachable code"94 bool "Perform checking for unreachable code"
95 # objtool already handles unreachable checking and gets angry about95 # objtool already handles unreachable checking and gets angry about
96 # seeing UBSan instrumentation located in unreachable places.96 # seeing UBSan instrumentation located in unreachable places.
97 depends on !STACK_VALIDATION97 depends on !(OBJTOOL && (STACK_VALIDATION || UNWINDER_ORC || X86_SMAP))
98 depends on $(cc-option,-fsanitize=unreachable)98 depends on $(cc-option,-fsanitize=unreachable)
99 help99 help
100 This option enables -fsanitize=unreachable which checks for control100 This option enables -fsanitize=unreachable which checks for control
scripts/Makefile.build+2−2
@@ -222,7 +222,7 @@ cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), · 221 unmodified lines
222 $(sub_cmd_record_mcount))222 $(sub_cmd_record_mcount))
223endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT223endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
224 224
225ifdef CONFIG_STACK_VALIDATION225ifdef CONFIG_OBJTOOL
226 226
227objtool := $(objtree)/tools/objtool/objtool227objtool := $(objtree)/tools/objtool/objtool
228 228
@@ -241,7 +241,7 @@ objtool_args = \ · 12 unmodified lines
241cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)241cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
242cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)242cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
243 243
244endif # CONFIG_STACK_VALIDATION244endif # CONFIG_OBJTOOL
245 245
246ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)246ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)
247 247
scripts/link-vmlinux.sh+18−14
@@ -108,8 +108,11 @@ objtool_link() · 107 unmodified lines
108 local objtoolcmd;108 local objtoolcmd;
109 local objtoolopt;109 local objtoolopt;
110 110
111 if is_enabled CONFIG_STACK_VALIDATION && \111 if ! is_enabled CONFIG_OBJTOOL; then
112 ( is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT ); then112 return;
113 fi
114
115 if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
113 116
114 # Don't perform vmlinux validation unless explicitly requested,117 # Don't perform vmlinux validation unless explicitly requested,
115 # but run objtool on vmlinux.o now that we have an object file.118 # but run objtool on vmlinux.o now that we have an object file.
@@ -126,10 +129,23 @@ objtool_link() · 10 unmodified lines
126 objtoolopt="${objtoolopt} --orc"129 objtoolopt="${objtoolopt} --orc"
127 fi130 fi
128 131
132 if is_enabled CONFIG_RETPOLINE; then
133 objtoolopt="${objtoolopt} --retpoline"
134 fi
135
136 if is_enabled CONFIG_SLS; then
137 objtoolopt="${objtoolopt} --sls"
138 fi
139
129 if is_enabled CONFIG_STACK_VALIDATION; then140 if is_enabled CONFIG_STACK_VALIDATION; then
130 objtoolopt="${objtoolopt} --stackval"141 objtoolopt="${objtoolopt} --stackval"
131 fi142 fi
132 143
144 if is_enabled CONFIG_X86_SMAP; then
145 objtoolopt="${objtoolopt} --uaccess"
146 fi
147
148
133 objtoolopt="${objtoolopt} --lto"149 objtoolopt="${objtoolopt} --lto"
134 fi150 fi
135 151
@@ -139,18 +155,6 @@ objtool_link() · 3 unmodified lines
139 155
140 if [ -n "${objtoolopt}" ]; then156 if [ -n "${objtoolopt}" ]; then
141 157
142 if is_enabled CONFIG_RETPOLINE; then
143 objtoolopt="${objtoolopt} --retpoline"
144 fi
145
146 if is_enabled CONFIG_SLS; then
147 objtoolopt="${objtoolopt} --sls"
148 fi
149
150 if is_enabled CONFIG_X86_SMAP; then
151 objtoolopt="${objtoolopt} --uaccess"
152 fi
153
154 if ! is_enabled CONFIG_FRAME_POINTER; then158 if ! is_enabled CONFIG_FRAME_POINTER; then
155 objtoolopt="${objtoolopt} --no-fp"159 objtoolopt="${objtoolopt} --no-fp"
156 fi160 fi
scripts/package/builddeb+1−1
@@ -67,7 +67,7 @@ deploy_kernel_headers () { · 66 unmodified lines
67 ) > debian/hdrsrcfiles67 ) > debian/hdrsrcfiles
68 68
69 {69 {
70 if is_enabled CONFIG_STACK_VALIDATION; then70 if is_enabled CONFIG_OBJTOOL; then
71 echo tools/objtool/objtool71 echo tools/objtool/objtool
72 fi72 fi
73 73
tools/include/linux/objtool.h+3−3
@@ -38,7 +38,7 @@ struct unwind_hint { · 37 unmodified lines
38#define UNWIND_HINT_TYPE_REGS_PARTIAL 238#define UNWIND_HINT_TYPE_REGS_PARTIAL 2
39#define UNWIND_HINT_TYPE_FUNC 339#define UNWIND_HINT_TYPE_FUNC 3
40 40
41#ifdef CONFIG_STACK_VALIDATION41#ifdef CONFIG_OBJTOOL
42 42
43#ifndef __ASSEMBLY__43#ifndef __ASSEMBLY__
44 44
@@ -157,7 +157,7 @@ struct unwind_hint { · 112 unmodified lines
157 157
158#endif /* __ASSEMBLY__ */158#endif /* __ASSEMBLY__ */
159 159
160#else /* !CONFIG_STACK_VALIDATION */160#else /* !CONFIG_OBJTOOL */
161 161
162#ifndef __ASSEMBLY__162#ifndef __ASSEMBLY__
163 163
@@ -179,6 +179,6 @@ struct unwind_hint { · 15 unmodified lines
179.endm179.endm
180#endif180#endif
181 181
182#endif /* CONFIG_STACK_VALIDATION */182#endif /* CONFIG_OBJTOOL */
183 183
184#endif /* _LINUX_OBJTOOL_H */184#endif /* _LINUX_OBJTOOL_H */