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
222222 $(sub_cmd_record_mcount))
223223 endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
224224
225−ifdef CONFIG_STACK_VALIDATION
225+ifdef CONFIG_OBJTOOL
226226
227227 objtool := $(objtree)/tools/objtool/objtool
228228
@@ -241,7 +241,7 @@ objtool_args = \ · 12 unmodified lines
241241 cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
242242 cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
243243
244−endif # CONFIG_STACK_VALIDATION
244+endif # CONFIG_OBJTOOL
245245
246246 ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)
247247
scripts/link-vmlinux.sh+18−14
@@ -108,8 +108,11 @@ objtool_link() · 107 unmodified lines
108108 local objtoolcmd;
109109 local objtoolopt;
110110
111− if is_enabled CONFIG_STACK_VALIDATION && \
112− ( is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT ); then
111+ if ! is_enabled CONFIG_OBJTOOL; then
112+ return;
113+ fi
114+
115+ if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
113116
114117 # Don't perform vmlinux validation unless explicitly requested,
115118 # but run objtool on vmlinux.o now that we have an object file.
@@ -126,10 +129,23 @@ objtool_link() · 10 unmodified lines
126129 objtoolopt="${objtoolopt} --orc"
127130 fi
128131
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+
129140 if is_enabled CONFIG_STACK_VALIDATION; then
130141 objtoolopt="${objtoolopt} --stackval"
131142 fi
132143
144+ if is_enabled CONFIG_X86_SMAP; then
145+ objtoolopt="${objtoolopt} --uaccess"
146+ fi
147+
148+
133149 objtoolopt="${objtoolopt} --lto"
134150 fi
135151
@@ -139,18 +155,6 @@ objtool_link() · 3 unmodified lines
139155
140156 if [ -n "${objtoolopt}" ]; then
141157
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−
154158 if ! is_enabled CONFIG_FRAME_POINTER; then
155159 objtoolopt="${objtoolopt} --no-fp"
156160 fi
scripts/package/builddeb+1−1
@@ -67,7 +67,7 @@ deploy_kernel_headers () { · 66 unmodified lines
6767 ) > debian/hdrsrcfiles
6868
6969 {
70− if is_enabled CONFIG_STACK_VALIDATION; then
70+ if is_enabled CONFIG_OBJTOOL; then
7171 echo tools/objtool/objtool
7272 fi
7373