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 scripts (3 of 17 files). Show all

Unified · Split

3 files
  1. scripts/Makefile.build +2 −2
  2. scripts/link-vmlinux.sh +18 −14
  3. scripts/package/builddeb +1 −1
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