Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9118459imu; Tue, 4 Dec 2018 22:13:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/VPMKa7gWLPvTF5O4JYik4kYk1A5nOjJjEg6Sc0GUZoF8wL3CfBAEaraw3a9zvbJaSzBmtr X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr23497175plt.106.1543990383558; Tue, 04 Dec 2018 22:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543990383; cv=none; d=google.com; s=arc-20160816; b=m1/f5qGv1shz3rUctEMlTTPTB2BnylKOKMTBJENLXqisjMuJhc5J+jUKOcAGlSOWjQ ROLX6A9jSmbFRaOztxykiMSYBJtCN3yAidaye5rCQd1rmmH2zmAQhgEdw4ejEOtIVSVe 2VFUC6yYwzywQfKBZR1/m1ZUEFAJFeAEv3+9IgMBSIO37Sv8n0v4MRbR04FzzfthGTHH w2uWISgBAV0juds/ugg0Mq+CM3yn68fNUXWYKUbfelcdPsPWutFz5Paj0/tJ/2dV2br3 zRWFLq75xCwixkGjxLSR06CZBwop0dWu39+m4Hb+VBOOJI+Qd2mt9E4etZasGbiEmWal 2B0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=HOQIBPGxhmfjxUen8ioHXZgbxEuLiOVnO/JS61x0USQ=; b=K+dxiKbO1p9LHdv5JUJigEQNxxoePJtAq/WFrs7PmTEyfcFO/ZABtWKrtJf8LQoXNU KGHa/mh6NM1UDTaV6uu8nw2Cqc14yTilQY6Gyqs+Q2XasE+8afR/vtQ9oHXayy+1nLFl Ef+iSDsu2X4hfB5KHDRc8mwKWX98n8aG/kaj7yNc4jJ2o/+UECbUgm5mrf7kNNc7ROiI yl+pp6FcoZWHmrIsBWd4DFdGWXxIQ0dCMp1JPVOiirEqtuVPioxHwVbahuYm1Th+3lFp NZRcs7TxettGUkWpWWgTIZ7mSrv2zbeKeHBjoEtzACGV+AAaNlJ6+gnmPTm70uKxGtER K8rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="Xe/M04di"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si17286276pgf.527.2018.12.04.22.12.47; Tue, 04 Dec 2018 22:13:03 -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=@nifty.com header.s=dec2015msa header.b="Xe/M04di"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbeLEGLu (ORCPT + 99 others); Wed, 5 Dec 2018 01:11:50 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:48625 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbeLEGLu (ORCPT ); Wed, 5 Dec 2018 01:11:50 -0500 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (authenticated) by conssluserg-03.nifty.com with ESMTP id wB56BQ5x024859 for ; Wed, 5 Dec 2018 15:11:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com wB56BQ5x024859 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543990287; bh=HOQIBPGxhmfjxUen8ioHXZgbxEuLiOVnO/JS61x0USQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Xe/M04dimj1bHZhD2o/dlyg6NyDy2J+a3Mbt5YxqnRbxdI18Yfwfejpgqht++mFWm crm3+DidCLhevi4fJMDSKg0/hGDFmeQbR1tJaZ1CmZvd8DNog4JGtGANsqx0Lur9B2 wQRWfGnVl4/KgnKw5ijmgJJXx9vde2bzByuJsFgEryvgv3uRyDP0rVGxu+UeZZYyNj eF+8PpVcjbgYTIZsm9XFdRHZuYjzIQB9nBZV4QM/IRQdOddDy68vb8QSELpS9E+88X Ew12ISN0uOcxZ4H3m/eHDwVic3H/8ZVYBLb/reS9DscTInMgmvyVCUZqXL54T2UtiB o6vWvTKzttFoQ== X-Nifty-SrcIP: [209.85.222.51] Received: by mail-ua1-f51.google.com with SMTP id p9so6700110uaa.5 for ; Tue, 04 Dec 2018 22:11:26 -0800 (PST) X-Gm-Message-State: AA+aEWZ1BV1g4Ri0boiMTX4qBScP2/58V+O8uwHTf8c3/oXBWSUHA+v1 EfErqI0tF1FN2AJfaecxWvDmSOgcR0q6FIk9ukc= X-Received: by 2002:a9f:3193:: with SMTP id v19mr10593921uad.55.1543990285835; Tue, 04 Dec 2018 22:11:25 -0800 (PST) MIME-Version: 1.0 References: <1543978802-24196-1-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Masahiro Yamada Date: Wed, 5 Dec 2018 15:10:49 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/build: fix compiler support check for CONFIG_RETPOLINE To: zhenzhong.duan@oracle.com Cc: Ingo Molnar , Thomas Gleixner , X86 ML , Meelis Roos , "H. Peter Anvin" , Borislav Petkov , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 5, 2018 at 3:08 PM Zhenzhong Duan wrote: > > > 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? Good catch. I will send v2. Thanks. > 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 -- Best Regards Masahiro Yamada