All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: add -fcf-protection=none when using retpoline flags
@ 2019-07-17 16:06 Seth Forshee
  2019-07-17 17:22 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Seth Forshee @ 2019-07-17 16:06 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: Josh Poimboeuf, linux-kbuild, linux-kernel

The gcc -fcf-protection=branch option is not compatible with
-mindirect-branch=thunk-extern. The latter is used when
CONFIG_RETPOLINE is selected, and this will fail to build with
a gcc which has -fcf-protection=branch enabled by default. Adding
-fcf-protection=none when building with retpoline enabled
prevents such build failures.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index 3e4868a6498b..73a94d1db2b6 100644
--- a/Makefile
+++ b/Makefile
@@ -878,6 +878,12 @@ KBUILD_CFLAGS   += $(call cc-option,-Werror=designated-init)
 # change __FILE__ to the relative path from the 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
+
 # use the deterministic mode of AR if available
 KBUILD_ARFLAGS := $(call ar-option,D)
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] kbuild: add -fcf-protection=none when using retpoline flags
  2019-07-17 16:06 [PATCH v2] kbuild: add -fcf-protection=none when using retpoline flags Seth Forshee
@ 2019-07-17 17:22 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2019-07-17 17:22 UTC (permalink / raw)
  To: Seth Forshee
  Cc: Michal Marek, Josh Poimboeuf, Linux Kbuild mailing list,
	Linux Kernel Mailing List

On Thu, Jul 18, 2019 at 1:07 AM Seth Forshee <seth.forshee@canonical.com> wrote:
>
> The gcc -fcf-protection=branch option is not compatible with
> -mindirect-branch=thunk-extern. The latter is used when
> CONFIG_RETPOLINE is selected, and this will fail to build with
> a gcc which has -fcf-protection=branch enabled by default. Adding
> -fcf-protection=none when building with retpoline enabled
> prevents such build failures.
>
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>

Applied to linux-kbuild. Thanks.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-17 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 16:06 [PATCH v2] kbuild: add -fcf-protection=none when using retpoline flags Seth Forshee
2019-07-17 17:22 ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.