Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11263643imu; Mon, 31 Dec 2018 17:38:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN4nsa9r6/3shRqdm5q7BXjM4hIHHSH6IfHZy2BcQ0qs73KqQ0M/mIjoy7MBp0VoHy/6V0J3 X-Received: by 2002:a17:902:2c03:: with SMTP id m3mr40419730plb.125.1546306728202; Mon, 31 Dec 2018 17:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546306728; cv=none; d=google.com; s=arc-20160816; b=b1cZA8Uw+JrhSEjBsY1z2Hafc0D7bdoKv3pGITbf6llCx2vtHbnARjV/wTknvvrbDB JSK3mJOqIW7HxwoUJ8DZAA7xwsczePu49SV60RkPJInYLeSMGQ7dYps76H2Y/XPzo1Cj G71L7ZQ/kYZCFokJ2YlLxBMcqu2R8s1eR+MtFdNHFQTqhrEZQKhu/0rrhpXMvigEhbeG gt9WEQE9j9LaRfyBv1327lmDmyKgdCgFtE+Pltiwv4vzy0phQAnPka518xXtFnel2JKl UWNWPnIXM1CnUvWAFOz2cmR4OmffxEZU/95i/srpfdXYTdlPOK0EXOhrp2eVEJtM7ULd PR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Etcmi8RSX+hgimxBPliyADtJKUIxOLcAt0THOcim+4I=; b=Y2t4mA8rQzYSY/ULkL327B2YSZvxa3O7KuU8T5h/G2fiKUiecJc0oBdkmYlAsiQ1y5 Uhel547cTzCcu4WNEkB38a187AX3VsJxh0ooJEclzbhfjF9+GZN36Woynj/DsRw9qUMS CFyqbsTgSOkR/ZX/f2vtGsv+8mEbWfPX7BNeIbryWQhryme9y0Ty0CdO95lzWMO5KNBA wuapXjaYlF32MM8elR4sVFbGjg3wrXpTcGrWLsDc+Q/0Hjquhx5x0uaFVnJ7l3tTQLo0 TCFBbkNLbFe1yk9IF5D6h/iWwyPEqPOT5HzZwE52pGH8TMjLMS+8TGgX/gef5t8G3+VV 1xcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si25530890pll.384.2018.12.31.17.38.18; Mon, 31 Dec 2018 17:38:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728008AbeLaXm2 (ORCPT + 99 others); Mon, 31 Dec 2018 18:42:28 -0500 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:12631 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727563AbeLaXm1 (ORCPT ); Mon, 31 Dec 2018 18:42:27 -0500 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Mon, 31 Dec 2018 15:42:22 -0800 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 23CE3B18BD; Mon, 31 Dec 2018 18:42:26 -0500 (EST) From: Nadav Amit To: Thomas Gleixner CC: , , Borislav Petkov , Ingo Molnar , Nadav Amit , Peter Zijlstra , Zhenzhong Duan , David Woodhouse , Andy Lutomirski , Masahiro Yamada , Subject: [PATCH] x86/retpoline: change RETPOLINE into CONFIG_RETPOLINE Date: Mon, 31 Dec 2018 15:42:53 -0800 Message-ID: <20181231234253.2724-1-namit@vmware.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-002.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent enhancement intentionally fails the kernel build if the compiler does not support retpolines and CONFIG_RETPOLINE is set. However, the patch that introduced it did not change RETPOLINE macro references into CONFIG_RETPOLINE ones. As a result, indirect branches that are used by init functions are not kept (i.e., they use retpolines), and modules that do not use retpolines are marked as retpoline-safe. Fix it be changing RETPOLINE into CONFIG_RETPOLINE. Fixes: 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support") Cc: Peter Zijlstra Cc: Zhenzhong Duan Cc: Thomas Gleixner Cc: David Woodhouse Cc: Andy Lutomirski Cc: Masahiro Yamada Cc: stable@vger.kernel.org Signed-off-by: Nadav Amit --- arch/x86/kernel/cpu/bugs.c | 2 +- include/linux/compiler-gcc.h | 2 +- include/linux/module.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 8654b8b0c848..1de0f4170178 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -215,7 +215,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 2010493e1040..977ddf2774f9 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -68,7 +68,7 @@ */ #define uninitialized_var(x) x = x -#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 fce6b4335e36..0c575f51fe57 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) -- 2.17.1