mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-18 00:24:39 +00:00
x86/build: Disable CET instrumentation in the kernel
commit20bf2b3787
upstream. With retpolines disabled, some configurations of GCC, and specifically the GCC versions 9 and 10 in Ubuntu will add Intel CET instrumentation to the kernel by default. That breaks certain tracing scenarios by adding a superfluous ENDBR64 instruction before the fentry call, for functions which can be called indirectly. CET instrumentation isn't currently necessary in the kernel, as CET is only supported in user space. Disable it unconditionally and move it into the x86's Makefile as CET/CFI... enablement should be a per-arch decision anyway. [ bp: Massage and extend commit message. ] Fixes:29be86d7f9
("kbuild: add -fcf-protection=none when using retpoline flags") Reported-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Tested-by: Nikolay Borisov <nborisov@suse.com> Cc: <stable@vger.kernel.org> Cc: Seth Forshee <seth.forshee@canonical.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Link: https://lkml.kernel.org/r/20210128215219.6kct3h2eiustncws@treble Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
40d0fff297
commit
bc1a3aeeff
2 changed files with 3 additions and 6 deletions
6
Makefile
6
Makefile
|
@ -920,12 +920,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
|
||||||
# change __FILE__ to the relative path from the srctree
|
# change __FILE__ to the relative path from the srctree
|
||||||
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
|
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
|
||||||
|
|
||||||
# ensure -fcf-protection is disabled when using retpoline as it is
|
|
||||||
# incompatible with -mindirect-branch=thunk-extern
|
|
||||||
ifdef CONFIG_RETPOLINE
|
|
||||||
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
|
|
||||||
endif
|
|
||||||
|
|
||||||
include scripts/Makefile.kasan
|
include scripts/Makefile.kasan
|
||||||
include scripts/Makefile.extrawarn
|
include scripts/Makefile.extrawarn
|
||||||
include scripts/Makefile.ubsan
|
include scripts/Makefile.ubsan
|
||||||
|
|
|
@ -131,6 +131,9 @@ else
|
||||||
|
|
||||||
KBUILD_CFLAGS += -mno-red-zone
|
KBUILD_CFLAGS += -mno-red-zone
|
||||||
KBUILD_CFLAGS += -mcmodel=kernel
|
KBUILD_CFLAGS += -mcmodel=kernel
|
||||||
|
|
||||||
|
# Intel CET isn't enabled in the kernel
|
||||||
|
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_X86_X32
|
ifdef CONFIG_X86_X32
|
||||||
|
|
Loading…
Reference in a new issue