mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
objtool, retpolines: Integrate objtool with retpoline support more closely
Disable retpoline validation in objtool if your compiler sucks, and otherwise select the validation stuff for CONFIG_RETPOLINE=y (most builds would already have it set due to ORC). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
0ca7d5baa1
commit
d5028ba8ee
4 changed files with 11 additions and 7 deletions
5
Makefile
5
Makefile
|
@ -489,6 +489,11 @@ KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
|
||||||
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
|
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
|
||||||
|
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
|
||||||
|
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
|
||||||
|
export RETPOLINE_CFLAGS
|
||||||
|
|
||||||
ifeq ($(config-targets),1)
|
ifeq ($(config-targets),1)
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# *config targets only - make sure prerequisites are updated, and descend
|
# *config targets only - make sure prerequisites are updated, and descend
|
||||||
|
|
|
@ -436,6 +436,7 @@ config GOLDFISH
|
||||||
config RETPOLINE
|
config RETPOLINE
|
||||||
bool "Avoid speculative indirect branches in kernel"
|
bool "Avoid speculative indirect branches in kernel"
|
||||||
default y
|
default y
|
||||||
|
select STACK_VALIDATION if HAVE_STACK_VALIDATION
|
||||||
help
|
help
|
||||||
Compile kernel with the retpoline compiler options to guard against
|
Compile kernel with the retpoline compiler options to guard against
|
||||||
kernel-to-user data leaks by avoiding speculative indirect
|
kernel-to-user data leaks by avoiding speculative indirect
|
||||||
|
|
|
@ -232,13 +232,9 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
||||||
|
|
||||||
# Avoid indirect branches in kernel to deal with Spectre
|
# Avoid indirect branches in kernel to deal with Spectre
|
||||||
ifdef CONFIG_RETPOLINE
|
ifdef CONFIG_RETPOLINE
|
||||||
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
|
ifneq ($(RETPOLINE_CFLAGS),)
|
||||||
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
|
|
||||||
|
|
||||||
RETPOLINE_CFLAGS += $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
|
|
||||||
ifneq ($(RETPOLINE_CFLAGS),)
|
|
||||||
KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
|
KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
archscripts: scripts_basic
|
archscripts: scripts_basic
|
||||||
|
|
|
@ -267,8 +267,10 @@ else
|
||||||
objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable)
|
objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable)
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_RETPOLINE
|
ifdef CONFIG_RETPOLINE
|
||||||
|
ifneq ($(RETPOLINE_CFLAGS),)
|
||||||
objtool_args += --retpoline
|
objtool_args += --retpoline
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifdef CONFIG_MODVERSIONS
|
ifdef CONFIG_MODVERSIONS
|
||||||
|
|
Loading…
Add table
Reference in a new issue