Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp12247327imu; Tue, 1 Jan 2019 18:31:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN4m1lgLtrFjmNXZEkyyVZkdTmovJVxLx5oqf12Mk+pjBm9ZGMtkjHpQxM+Qu58qD0PKNrMx X-Received: by 2002:a65:65c9:: with SMTP id y9mr12439528pgv.438.1546396311389; Tue, 01 Jan 2019 18:31:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546396311; cv=none; d=google.com; s=arc-20160816; b=NupY6/P/s4s/s6A3L2PZCcIT7W525kfr3e/XXF7jMZ5nD3eRC6UYrP/XxR13SqZ5gz e9jPpe7MTnuPMBqpSeRSP/4CZ9aUzDEE0igEGpdYgFYYfGCjm5SxenfLEaT8YuquXrvk POCIce6U5jBVYL9BhVfltFsfp4OoOIiLTrcOb5A9qK33LL6EvSLRzEbJMqZiLkbl9sk4 pI8ALMsBppJmLySzw9AyLm4oP7NUmwGS7qWxeMXm98h5ppZq+CC8yK9ee0KtgQ11PbkC Wglrh+w1q0LqYGO03Bffa2WaIk2WRWxVxXUYDII8ggetFpXP+qSP5ReNyxK429/lEAtT yA4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=DOEFMh2Em9wTUlaM+xAb4z+7QOtFFUelr7kMXpNVW5Y=; b=cX6WN+Q48xsYVwmurSwiuWIq5cgwy9aiUr2kQ2er+d2Zi/yyr8uJYzxwpgBahviKQt 1ub3Gu8iQbTpdkVeZh89Y2q2xrLHa05MUUTYfZ/8//TQaH2BRP+GXCJUa0wrgq66YOKD kGNccdWiAQ9iQMDu7mf2QNHuLgo37pqcrZ1Lea6VOempFUTLC9ZczrbmNQFsO2oCIXjt CEiky6CpLuAENyq6m7DawxIUfexcMzKFpdEHH592Vmgraw+4vMgvgTKmikTOgh+15ew4 QeQc5I3BcozYZhxqcmjgkw8S5IuVOiDWFjPoHpiYlb0dkv06QZmimxxB1ef8KUj3yK3y ZGgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=YH8FObRp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si46850879pgv.111.2019.01.01.18.31.15; Tue, 01 Jan 2019 18:31:51 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=YH8FObRp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbfABBRt (ORCPT + 99 others); Tue, 1 Jan 2019 20:17:49 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:56198 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbfABBRt (ORCPT ); Tue, 1 Jan 2019 20:17:49 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0218u2f194857; Wed, 2 Jan 2019 01:17:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=DOEFMh2Em9wTUlaM+xAb4z+7QOtFFUelr7kMXpNVW5Y=; b=YH8FObRpxHDPnFatzl6VA+CUkkW4V/9oxOHr0JATbjzGvy7/8916bnslAarcBu7Dgucs f+JKO8T3vdxDTsqzsofpJPISJhrrQQf80JZsJrSHUbG6R+IcXX0c12rKGomQnJDRPGi8 lqC420st/BdgTygJZT/vHc6R8282a7keqc0wEwGaWVK1KQONOCX3caBLp6F77XS6x10H hEWFGHH5asNvWFLcevSjINhoQlBzz+KaZIoDjCqMN60ZdI3vamzr6ekem3h4cTy9Pl6o Whz70obaVZUX/cBfVdOZkek3g9Os0OO/sS7uR9YQGUF4HqDYqMzNo+IMokk5YtSW3HD2 sA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2pp1jr006t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Jan 2019 01:17:09 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x021H8i7014968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Jan 2019 01:17:08 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x021H6sq004834; Wed, 2 Jan 2019 01:17:06 GMT Received: from [10.191.15.253] (/10.191.15.253) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Jan 2019 17:17:06 -0800 Subject: Re: [PATCH] x86/retpoline: change RETPOLINE into CONFIG_RETPOLINE To: Nadav Amit , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , Ingo Molnar , Peter Zijlstra , David Woodhouse , Andy Lutomirski , Masahiro Yamada , stable@vger.kernel.org References: <20181231234253.2724-1-namit@vmware.com> From: Zhenzhong Duan Organization: Oracle Corporation Message-ID: Date: Wed, 2 Jan 2019 09:17:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181231234253.2724-1-namit@vmware.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9123 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901020008 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/1/1 7:42, Nadav Amit wrote: > 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) Someone sent a similar patch last month, see below link,  you missed the change in scripts/mod/modpost.c https://lkml.org/lkml/2018/12/10/540 But you patch description is more clear. -- Thanks Zhenzhong