Merge tag 'objtool-urgent-2022-06-05' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Jun 2022 16:45:27 +0000 (09:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Jun 2022 16:45:27 +0000 (09:45 -0700)
Pull objtool fixes from Thomas Gleixner:

 - Handle __ubsan_handle_builtin_unreachable() correctly and treat it as
   noreturn

 - Allow architectures to select uaccess validation

 - Use the non-instrumented bit test for test_cpu_has() to prevent
   escape from non-instrumentable regions

 - Use arch_ prefixed atomics for JUMP_LABEL=n builds to prevent escape
   from non-instrumentable regions

 - Mark a few tiny inline as __always_inline to prevent GCC from
   bringing them out of line and instrumenting them

 - Mark the empty stub context_tracking_enabled() as always inline as
   GCC brings them out of line and instruments the empty shell

 - Annotate ex_handler_msr_mce() as dead end

* tag 'objtool-urgent-2022-06-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/extable: Annotate ex_handler_msr_mce() as a dead end
  context_tracking: Always inline empty stubs
  x86: Always inline on_thread_stack() and current_top_of_stack()
  jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds
  x86/cpu: Elide KCSAN for cpu_has() and friends
  objtool: Mark __ubsan_handle_builtin_unreachable() as noreturn
  objtool: Add CONFIG_HAVE_UACCESS_VALIDATION

1  2 
arch/Kconfig
arch/x86/Kconfig
scripts/Makefile.lib

diff --cc arch/Kconfig
Simple merge
Simple merge
index f691fb231ce52b099f268c1cd0728652eb439587,0453a1904646af35f60c7606a55058e6cb732c82..d1425778664b9956c8a639e21ee8a096b10e2a70
@@@ -225,31 -225,12 +225,31 @@@ dtc_cpp_flags  = -Wp,-MMD,$(depfile).pr
                 $(addprefix -I,$(DTC_INCLUDE))                          \
                 -undef -D__DTS__
  
 -ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)
 -# With CONFIG_LTO_CLANG, .o files in modules might be LLVM bitcode, so we
 -# need to run LTO to compile them into native code (.lto.o) before further
 -# processing.
 -mod-prelink-ext := .prelink
 -endif
 +ifdef CONFIG_OBJTOOL
 +
 +objtool := $(objtree)/tools/objtool/objtool
 +
 +objtool_args =                                                                \
 +      $(if $(CONFIG_HAVE_JUMP_LABEL_HACK), --hacks=jump_label)        \
 +      $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr)              \
 +      $(if $(CONFIG_X86_KERNEL_IBT), --ibt)                           \
 +      $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)             \
 +      $(if $(CONFIG_UNWINDER_ORC), --orc)                             \
 +      $(if $(CONFIG_RETPOLINE), --retpoline)                          \
 +      $(if $(CONFIG_SLS), --sls)                                      \
 +      $(if $(CONFIG_STACK_VALIDATION), --stackval)                    \
 +      $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call)          \
-       --uaccess                                                       \
++      $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess)              \
 +      $(if $(delay-objtool), --link)                                  \
 +      $(if $(part-of-module), --module)                               \
 +      $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
 +
 +delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT))
 +
 +cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
 +cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
 +
 +endif # CONFIG_OBJTOOL
  
  # Useful for describing the dependency of composite objects
  # Usage: