Skip to contentSkip to conversation

x86/retpoline: Fix forcing me to update my compiler

PATCH In review Kirill Marinushkin 3 participants 4 messages Dec 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/retpoline: Fix forcing me to update my compiler

First problem: I cannot compile the kernel with my version of compiler

~~~~

$ make defconfig
*** Default configuration is based on 'i386_defconfig'
\#
\# configuration written to .config
\#
$ grep CONFIG_RETPOLINE .config
CONFIG_RETPOLINE=y
$ make
arch/x86/Makefile:224: *** You are building kernel with non-retpoline
compiler, please update your compiler..  Stop.
~~~~

Second problem: when I disable the feature - it cannot take effect, because the parse-time error happens before syncconfig

~~~~

$ scripts/config -d RETPOLINE
$ grep CONFIG_RETPOLINE .config
\# CONFIG_RETPOLINE is not set
$ make
arch/x86/Makefile:224: *** You are building kernel with non-retpoline
compiler, please update your compiler..  Stop.
~~~~
Fixes 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support")
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhenzhong Duan <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/Makefile | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/Makefile +0 -3
index f5d7f4134524..26a2198c59b3 100644
@@ -220,9 +220,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 
 # Avoid indirect branches in kernel to deal with Spectre
 ifdef CONFIG_RETPOLINE
-ifeq ($(RETPOLINE_CFLAGS),)
-  $(error You are building kernel with non-retpoline compiler, please update your compiler.)
-endif
   KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
 endif
 
Signature · 1 line
2.13.6
maintainer
#1 lore raw
Quoted 14 lines · Kirill Marinushkin

First problem: I cannot compile the kernel with my version of compiler

~~~~

$ make defconfig
*** Default configuration is based on 'i386_defconfig'
\#
\# configuration written to .config
\#
$ grep CONFIG_RETPOLINE .config
CONFIG_RETPOLINE=y
$ make
arch/x86/Makefile:224: *** You are building kernel with non-retpoline
compiler, please update your compiler..  Stop.
~~~~

Does this help?

https://git.kernel.org/tip/25896d073d8a0403b07e6dec56f58e6c33678207

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#2 lore raw
Quoted 4 lines
Quoted 4 lines

First problem: I cannot compile the kernel with my version of compiler

Second problem: when I disable the feature - it cannot take effect, because the parse-time error happens before syncconfig

Quoted 4 lines · Borislav Petkov

Does this help?

https://git.kernel.org/tip/25896d073d8a0403b07e6dec56f58e6c33678207

The patch which you mentioned fixes the second problem: now I can disable CONFIG_RETPOLINE.
But, the first problem is still here: with defconfig and gcc v6.4.0, kernel doesn't build, with this message:

~~~~

$ make
scripts/kconfig/conf  --syncconfig Kconfig
You are building kernel with non-retpoline compiler.
Please update your compiler.
make: *** [arch/x86/Makefile:311: checkbin] Error 1
~~~~

I don't think that this is a proper behavior. I suggest to allow compilation

Best Regards,
Kirill

maintainer
#3 lore raw
Quoted 17 lines · Kirill Marinushkin
Quoted 4 lines
Quoted 4 lines

First problem: I cannot compile the kernel with my version of compiler

Second problem: when I disable the feature - it cannot take effect, because the parse-time error happens before syncconfig

Quoted 4 lines · Borislav Petkov

Does this help?

https://git.kernel.org/tip/25896d073d8a0403b07e6dec56f58e6c33678207

The patch which you mentioned fixes the second problem: now I can disable CONFIG_RETPOLINE.
But, the first problem is still here: with defconfig and gcc v6.4.0, kernel doesn't build, with this message:

~~~~

Quoted 8 lines
$ make
scripts/kconfig/conf  --syncconfig Kconfig
You are building kernel with non-retpoline compiler.
Please update your compiler.
make: *** [arch/x86/Makefile:311: checkbin] Error 1
~~~~

I don't think that this is a proper behavior. I suggest to allow compilation

No, you asked for retpoline, and your compiler can not provide that, so erroring out is the correct behavior. It is worse for you to have an option enabled and it not being enabled just because your compiler does not support it. That way you do not have the false sense of security.

thanks,

greg k-h