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

Showing the changes to include (3 of 17 files). Show all

Unified · Split

3 files
  1. include/linux/compiler.h +3 −3
  2. include/linux/instrumentation.h +3 −3
  3. include/linux/objtool.h +3 −3
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 */