Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3856889imu; Tue, 18 Dec 2018 05:24:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/WNEtfjU3H19JcbEYLO6puR6a1vLjcnI9eeRuFcN0xUAagyXpBlI4DWI8ripuMnnfZGtfbk X-Received: by 2002:a62:64d7:: with SMTP id y206mr16739277pfb.84.1545139491776; Tue, 18 Dec 2018 05:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545139491; cv=none; d=google.com; s=arc-20160816; b=NJ8rmSIEDz8uKi7LxotapI/R11MIDkDlnjSg6GFzqt787hKKN5Vi4Vy4AxwmVqxbQ/ +rwq1Y41/6v099nirjg62tZBYWYjgSPp5QxaeSquqtLfBUXkVtzMzcdLUB+Rq3j8htoU 7ZVIQjYrOFVw0iVLHLktqfUxb2/USlkeQaXemy37qJE6z6T7SI6xmIYz+BfKpB0B3ClM pfuI7+UzeD9keyktTfH9mL+utQMHlSIJ2uerIJez6cN9NWCC+4bp94nkVa6SOb6ud3XZ +7Hk0a50vUunmOQw8wn3fRjFM8D7/3tzho0a45M+JhJ4PP84evmX0e1yUbz7RPzGFEv7 ZGHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=835B9a2Vrobw8Jh8WycCsmQ+PVowpzDBSA7NR7cwFtw=; b=BbcB9a2YgmsWevlCbW7N9w1xOHGWm5KNGENZVYLcqCtrP5B8ECsWacdow3ik66Sf42 vXtq6QVKlpcCaitWoqoH7S69k2LLzruhdTQqgkRiiU6JECojxiXbuF41HaMdkM4lNvBO CseOuSeMvy5fU6eHfXTMec0JacNOnJ5twJIxskYLBJgRmfb3TMrcuTZY9SVCRNO8sabn twQMzGEyPRg7t4sY3CInkSlqyjyieibOGQ31WeXoPCSgbh5djugl+nHoukvOhkh8UIBB RhzUcE1aFz39kNiUJtaipqqdM3ngRvq32HnmVtZrGqYGrqGudxUyHxUk75kpsJYUdddH jI8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=dv0sNj9k; 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 2si13180837pgj.104.2018.12.18.05.24.36; Tue, 18 Dec 2018 05:24: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=@cloud.ionos.com header.s=google header.b=dv0sNj9k; 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 S1726751AbeLRNVW (ORCPT + 99 others); Tue, 18 Dec 2018 08:21:22 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37384 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbeLRNVW (ORCPT ); Tue, 18 Dec 2018 08:21:22 -0500 Received: by mail-ed1-f66.google.com with SMTP id h15so13862881edb.4 for ; Tue, 18 Dec 2018 05:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=835B9a2Vrobw8Jh8WycCsmQ+PVowpzDBSA7NR7cwFtw=; b=dv0sNj9khPmPJBhuU/WNB+LCUNOs1XytZPxWEhwJWq2BPy6ukhGXxv2ZDj+3NhztkA fIMNyZGRVrtSD/JV+7bjKyIgTQBFDks+rCVgniR5k9UBQGbGUmGr+XkDdqTxY4G5Fiqi BVopNe01SMs20eM581iO6275JPtxqzcerM0StK8RR7Dt9WhlrOxRvZynC0yPGB1bqZBP hLm7sjVjmz/ZMXHK/YSJKeD2M8Dc/NTW/tcL+CkrnhjZ9r17yF3co8erFNVguCuuVISW AkSQiZf5Sk4g9C5dKHOYxK+ZXciVelTXbD8iIB8Uvrkkc6b5VgCAZ0lBwP8XcdjcgUyZ +Y8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=835B9a2Vrobw8Jh8WycCsmQ+PVowpzDBSA7NR7cwFtw=; b=K5T5XGARQB9OKvxaEsKh90f/pofuqo7sal75S39RrXf84zwX+4XfLZ5cLdIC+/JKzT 5yoJbazHI4ZdOMYFZwIkwWc1uGqKqfyhA2t/Ax6SHQi4xp4sxNv+f1SIYbQAwul/jf8v 2SNTiOYR1dR43TGCm5Uz77ZCMINSRkZBBf8MpVHe8Sn6h5ChlhnUaGZg/uPkB4tVgLE7 M4JwWLlgzLsXRfL6QIwccD/vpDwO350IuIMyrYaUpTsiV7uHcmQDiIK4JGRZaGllg6o5 xzmpCcrsb4fG3sBhVUQB6nAq+qBcS1IIUdhEG/vXnjTQYnpvBaoKNxOxewDMiBbdE8yU TATg== X-Gm-Message-State: AA+aEWY3Ln/JyMgqybT5H9e6bvQJuYfrrzfYneMe4BIqjzTSvHNk5z3F d780P/fp74HCCORmWz7NeLVueES85vC8YDWMZCNERw== X-Received: by 2002:a50:9770:: with SMTP id d45mr15483391edb.49.1545139280043; Tue, 18 Dec 2018 05:21:20 -0800 (PST) MIME-Version: 1.0 References: <1543991239-18476-1-git-send-email-yamada.masahiro@socionext.com> <34aa8fad-ee7f-6833-41a2-00a92b4ad369@oracle.com> In-Reply-To: <34aa8fad-ee7f-6833-41a2-00a92b4ad369@oracle.com> From: Gi-Oh Kim Date: Tue, 18 Dec 2018 14:20:44 +0100 Message-ID: Subject: Re: [PATCH v2] x86/build: fix compiler support check for CONFIG_RETPOLINE To: zhenzhong.duan@oracle.com Cc: yamada.masahiro@socionext.com, mingo@redhat.com, tglx@linutronix.de, x86@kernel.org, mroos@linux.ee, hpa@zytor.com, Borislav Petkov , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 8:11 AM Zhenzhong Duan w= rote: > > > On 2018/12/5 14:27, Masahiro Yamada wrote: > > It is troublesome to add a diagnostic like this to the Makefile > > parse stage because the top-level Makefile could be parsed with > > a stale include/config/auto.conf. > > > > 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 > > Fixes: 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on co= mpiler support") > > Reported-by: Meelis Roos > > Signed-off-by: Masahiro Yamada > > --- > > > > Changes in v2: > > - Revive ifdef CONFIG_RETPOLINE surrounding the KBUILD_CFLAGS additi= on > > - Rephase the commit log a bit, hoping the cause of the issue will b= e clearer > > > > arch/x86/Makefile | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > > index f5d7f41..75ef499 100644 > > --- a/arch/x86/Makefile > > +++ b/arch/x86/Makefile > > @@ -220,9 +220,6 @@ KBUILD_CFLAGS +=3D -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 +=3D $(RETPOLINE_CFLAGS) > > endif > > > > @@ -307,6 +304,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 > Acked-by: Zhenzhong Duan > > -- > Regards > Zhenzhong > Hi, I think this patch needs to be merged to linux-stable 4.14.y branch. Following is what I did to reproduce the problem. The problem is gone after applying the patch. 1. I created and installed a headers package as following. make -j7 deb-pkg cd .. sudo dpkg -i linux-headers-4.14.89+_4.14.89+-18_amd64.deb 2. I managed to re-produce the same problem as following. gohkim@ws00837:~/study/drv$ make -C /usr/src/linux-headers-4.14.89+/ kernelrelease make: Entering directory '/usr/src/linux-headers-4.14.89+' arch/x86/Makefile:245: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop. make: Leaving directory '/usr/src/linux-headers-4.14.89+' 3. Weird thing is that it works fine if I use sudo command. gohkim@ws00837:~/study/drv$ sudo make -C /usr/src/linux-headers-4.14.89+/ kernelrelease make: Entering directory '/usr/src/linux-headers-4.14.89+' HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf --silentoldconfig Kconfig 4.14.89 make: Leaving directory '/usr/src/linux-headers-4.14.89+' --=20 GIOH KIM Linux Kernel Entwickler 1&1 IONOS Cloud GmbH Greifswalder Str. 207 D - 10405 Berlin Tel: +49 176 2697 8962 Fax: +49 30 577 008 299 Email: gi-oh.kim@cloud.ionos.com URL: https://www.ionos.com Sitz der Gesellschaft: Berlin Registergericht: Amtsgericht Charlottenburg, HRB 125506 B Gesch=C3=A4ftsf=C3=BChrer: Achim Weiss, Matthias Steinberg, Christoph Steff= ens