[SRU][Cosmic][PATCH 4/4] x86, modpost: Replace last remnants of RETPOLINE with CONFIG_RETPOLINE

Juerg Haefliger juerg.haefliger at canonical.com
Mon Mar 25 13:55:55 UTC 2019


From: WANG Chao <chao.wang at ucloud.cn>

Commit

  4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support")

replaced the RETPOLINE define with CONFIG_RETPOLINE checks. Remove the
remaining pieces.

 [ bp: Massage commit message. ]

Fixes: 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support")
Signed-off-by: WANG Chao <chao.wang at ucloud.cn>
Signed-off-by: Borislav Petkov <bp at suse.de>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan at oracle.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro at socionext.com>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: Andi Kleen <ak at linux.intel.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Andy Lutomirski <luto at kernel.org>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Daniel Borkmann <daniel at iogearbox.net>
Cc: David Woodhouse <dwmw at amazon.co.uk>
Cc: Geert Uytterhoeven <geert at linux-m68k.org>
Cc: Jessica Yu <jeyu at kernel.org>
Cc: Jiri Kosina <jkosina at suse.cz>
Cc: Kees Cook <keescook at chromium.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Cc: Luc Van Oostenryck <luc.vanoostenryck at gmail.com>
Cc: Michal Marek <michal.lkml at markovi.net>
Cc: Miguel Ojeda <miguel.ojeda.sandonis at gmail.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Tim Chen <tim.c.chen at linux.intel.com>
Cc: Vasily Gorbik <gor at linux.ibm.com>
Cc: linux-kbuild at vger.kernel.org
Cc: srinivas.eeda at oracle.com
Cc: stable <stable at vger.kernel.org>
Cc: x86-ml <x86 at kernel.org>
Link: https://lkml.kernel.org/r/20181210163725.95977-1-chao.wang@ucloud.cn

CVE-2017-5715

(backported from commit e4f358916d528d479c3c12bd2fd03f2d5a576380)
[juergh: Adjusted context.]
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
 arch/x86/kernel/cpu/bugs.c   | 2 +-
 include/linux/compiler-gcc.h | 2 +-
 include/linux/module.h       | 2 +-
 scripts/mod/modpost.c        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 716130e08528..c2645bb25b65 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -213,7 +213,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init =
 static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init =
 	SPECTRE_V2_USER_NONE;
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 static bool spectre_v2_bad_module;
 
 bool retpoline_module_ok(bool has_retpoline)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 573f5a7d42d4..4e0a4a287d73 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -108,7 +108,7 @@
 #define __weak		__attribute__((weak))
 #define __alias(symbol)	__attribute__((alias(#symbol)))
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 #define __noretpoline __attribute__((indirect_branch("keep")))
 #endif
 
diff --git a/include/linux/module.h b/include/linux/module.h
index d44df9b2c131..c24ac7fb00ee 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -817,7 +817,7 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr,
 static inline void module_bug_cleanup(struct module *mod) {}
 #endif	/* CONFIG_GENERIC_BUG */
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 extern bool retpoline_module_ok(bool has_retpoline);
 #else
 static inline bool retpoline_module_ok(bool has_retpoline)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b95cf57782a3..41d17e6beaa3 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2154,7 +2154,7 @@ static void add_intree_flag(struct buffer *b, int is_intree)
 /* Cannot check for assembler */
 static void add_retpoline(struct buffer *b)
 {
-	buf_printf(b, "\n#ifdef RETPOLINE\n");
+	buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n");
 	buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n");
 	buf_printf(b, "#endif\n");
 }
-- 
2.19.1




More information about the kernel-team mailing list