Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9115633imu; Tue, 4 Dec 2018 22:08:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WCNcmUrlMzXV2c9WeDmC15kD3iXhS3ZMnFBEM8dtLTrIXo3vk89IAwZdXNXMGtU7M9rpu3 X-Received: by 2002:a63:2d46:: with SMTP id t67mr18566730pgt.140.1543990116044; Tue, 04 Dec 2018 22:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543990116; cv=none; d=google.com; s=arc-20160816; b=se17eA9JCooDx8kyJObs9/aXi3+8/5d4wqvpiU/baOvbeSpWX5oKsYYN1EbFTOJ9Mb Sf+ZOd+JkJRs2QWp18Z/KRDoTXs0EFed7AMGzY4pKpGKM3QHVau1LAHwllrM3/7H3r4i 3XYBkVqDrH833rb5+rmImldxbFedbTv4hxIIfTvonpsuVL5CiE5VnxYF9OZsMk4gYTs3 Pq5coRcUyjszVmFN26kW9r+0b2UIelRwBxoGrVbMZqDAn/Pwbf8iNhVxQVzEr/OYc97L b/+S53pkaqFgm38BNQAlkM3yyftUarvAj9+BdEpFOsjIEOv8iHqCS0ANCf7OmJPJkPCy 5rog== 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=e9iFII9C1C0acSfgyX90GXg6qSj2zoATcOqH0dCyByE=; b=HNtFUXzhInbPOPkkIqfifKTYQVN9tOBsUC43ZIWiuKwmo9/KvpY43bRpo7pe8G9bjQ VyFTuDnhYPSbuN/v05GdL3M8FeJAhJQS0aAOQtMfRF1ShZBHUO0WHSaXHqoqEU7c5wJI fP1fwEjUnCq0Q7TsRaUmvI+9/fvUprr0ZlLMZy1fyetRsivqOLV/qKTIiqf/JM4zDBz6 k+PJhOkE1FZ4iIuZfGT3ETQgtS98b253mYFblT4ee1nuMKSjhvMomLNCcoe22xTPpiG/ i+vg3855PLSE+BiA5E1gSPOnQrTwGMw8KeZ2F+IGYvAwwpn6WUTU3ymlW6j2aHcQswyq rd8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=0pYmpW7r; 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 g11si2714994plt.4.2018.12.04.22.08.20; Tue, 04 Dec 2018 22:08:35 -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=0pYmpW7r; 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 S1726973AbeLEGHc (ORCPT + 99 others); Wed, 5 Dec 2018 01:07:32 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51932 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbeLEGHb (ORCPT ); Wed, 5 Dec 2018 01:07:31 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB564INK094690; Wed, 5 Dec 2018 06:07:12 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=e9iFII9C1C0acSfgyX90GXg6qSj2zoATcOqH0dCyByE=; b=0pYmpW7rn7CSAlDuSy+Bifgh5ZtTTfz/mGjEVBOPeMdEfu5hHTZWRPm6avAr1JKqF3x3 B3xfI8trsb124YYYenBGOVV910u1OrgoAnOhjQ0VJRX0InX9iHcWGD4vHKjBULotaFsO OBSaTj2k4RJwGOP1Lr9WYLdGlSFCyfQgNRQViphiTd7eWClK66sPhTczY40j41ZJMCm7 MzUAGGMx4+5dCAl/3fwXKymlaMQQ5lkphT/40z73vsuM/Mo5PTvitLnP0A+dA3WgwFNP 20OZg5/0MVPJM98m2TLFnCqBOqHD7IxyMCmx3Nlabw7eZcpT/agRrWIzZgu/ck4ksJk5 mg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2p3hqu0f97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Dec 2018 06:07:12 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wB567AFd000472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Dec 2018 06:07:11 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB5678w1018626; Wed, 5 Dec 2018 06:07:08 GMT Received: from [10.191.30.150] (/10.191.30.150) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 04 Dec 2018 22:07:08 -0800 Subject: Re: [PATCH] x86/build: fix compiler support check for CONFIG_RETPOLINE To: Masahiro Yamada , Ingo Molnar , Thomas Gleixner , x86@kernel.org Cc: Meelis Roos , "H. Peter Anvin" , Borislav Petkov , linux-kernel@vger.kernel.org References: <1543978802-24196-1-git-send-email-yamada.masahiro@socionext.com> From: Zhenzhong Duan Organization: Oracle Corporation Message-ID: Date: Wed, 5 Dec 2018 14:07:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <1543978802-24196-1-git-send-email-yamada.masahiro@socionext.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9097 signatures=668686 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-1812050056 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/12/5 11:00, Masahiro Yamada wrote: > It is wrong to add CONFIG option diagnostic to the Makefile parse > stage. > > Once you are hit by the error about non-retpoline compiler, the > compilation still breaks even after disabling CONFIG_RETPOLINE. > > The easiest fix is to move this check to the "archprepare" like commit > 829fe4aa9ac1 ("x86: Allow generating user-space headers without a > compiler") did. > > Link: https://lkml.org/lkml/2018/12/4/206 > Reported-by: Meelis Roos > Fixes: 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support") > Signed-off-by: Masahiro Yamada > --- > > arch/x86/Makefile | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index f5d7f41..ae0148b 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -219,12 +219,7 @@ KBUILD_CFLAGS += -Wno-sign-compare > 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 > +KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) Is it better to also move "# Avoid indirect branches in kernel to deal with Spectre" and "KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)"? Seems unconditionaly using "KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)" will have compiler using "__x86_indirect_thunk_\reg" call even ifCONFIG_RETPOLINE is disabled. I guess link process will fail? Thanks Zhenzhong > > archscripts: scripts_basic > $(Q)$(MAKE) $(build)=arch/x86/tools relocs > @@ -307,6 +302,13 @@ ifndef CC_HAVE_ASM_GOTO > @echo Compiler lacks asm-goto support. > @exit 1 > endif > +ifdef CONFIG_RETPOLINE > +ifeq ($(RETPOLINE_CFLAGS),) > + @echo "You are building kernel with non-retpoline compiler." >&2 > + @echo "Please update your compiler." >&2 > + @false > +endif > +endif > > archclean: > $(Q)rm -rf $(objtree)/arch/i386