Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5640418imd; Tue, 30 Oct 2018 22:56:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5eoE2FpancKMhCkISzBbDOHChuEyC7RlOel1/kBIfJ8AcEBQ7PlEmrr1D3hYZ7a7aubB3pt X-Received: by 2002:a62:640c:: with SMTP id y12-v6mr1883123pfb.249.1540965397955; Tue, 30 Oct 2018 22:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540965397; cv=none; d=google.com; s=arc-20160816; b=qtObnj7+NMJC9e0VwXmHL7TufGIHzfaNSFoJpGl4QGIRA87aFr88MoRkDFP5T9IFoY 154tssnxdzMCmqP+2R7sD7Ki2nPUzva5x0gQJ9yB5T8mf9Nmo/1NGzxWb7iAvBYUmkx1 7mSEi3H9EQWMubQsCs0B8hkB3EhgNXJrbBMDdqK9ejG0GNcA9u88YtdmZISiok0hqK3K xqbKO/H4hJTVP9bRKxnlrs0W+zbrYSO87D4oAjLVoSaYeku2ou8+8jz9KY/iYdtH8oXo +2V2EOS35m2T755srRkiPza48oV7Cy7u5g7gw+NpE1QTOD/pOKKPIljSBxeH/jXcxFT7 fecw== 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:in-reply-to :mime-version:user-agent:date:message-id:organization:from :references:cc:to:subject:reply-to:dkim-signature; bh=G1VVVcYCN4EZbsbTkW8AQheDoypc/vN9x/H1l0xo2PU=; b=RvVFxn3Mf6fGM+dEB50KP1wqi47MqxhqcHzeO//oz2D09nqJ6cuNmUq91tAX3YjMyS d/xLQl1XXKQfvct/bNLFSfleLfZqxQNBv38cwe8GWzu0sKwrZTLa214haNAiQvTsOL8I asqaM1taWXoXFObPpqIVkvDzKBqmVYlYUPjmzsrvcHwhl5TLgG8CkTdYCxfAfn+1Fq+t AG688hGYGeydZuIY1GrLLWkCVw5MQ7zuxOtkzuaTUSRqQgmKFRsoCXL76iAUjL0EjBuS cMgVjTrzERQ5YnWzU1/ezG8dBpih0cFJ9UfarN2GjGd/5D3xl4h6Tp5WvK9tr4g93GHz cvKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=QtMwkrZH; 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 a11si176566pga.198.2018.10.30.22.56.22; Tue, 30 Oct 2018 22:56:37 -0700 (PDT) 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=QtMwkrZH; 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 S1729025AbeJaOwU (ORCPT + 99 others); Wed, 31 Oct 2018 10:52:20 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:47992 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbeJaOwU (ORCPT ); Wed, 31 Oct 2018 10:52:20 -0400 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 w9V5dQYu020674; Wed, 31 Oct 2018 05:54:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=reply-to : subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=G1VVVcYCN4EZbsbTkW8AQheDoypc/vN9x/H1l0xo2PU=; b=QtMwkrZHpA35j0PWFPVevMg6ZLyBqV/miQIDY8v4uuv1d2K8+h9I8YJoouB21bSMpH7A BRYsUBc1I7hMdhpBPmnoKdGxAqVYFwKRwX76+hZ40SsLsgn3v+efM2bKj1K3FaNaKMxc 862YVw7tyvcw/kurGMrTjAL9jgoz5X0RnX+PJ7/RtZmwHTSHqcu62B0vZ8F84LOz6t5N tG9akOug5PuBg2ve1ckcn+rBVDUvRzpMLWWR6O0IRphfn48WpnpHavH1as4qEFY2M3R/ y4KQGqx9cIMszR8Bn74/VpfJzy7XAUe2hZeTjbsVycRnY3IcCX/yzdKQhtJ+RB7//nnQ rQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2ncgnr0gnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Oct 2018 05:54:36 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9V5sXq2004793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Oct 2018 05:54:34 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9V5sWuv029642; Wed, 31 Oct 2018 05:54:32 GMT Received: from [10.191.22.95] (/10.191.22.95) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Oct 2018 22:54:32 -0700 Reply-To: zhenzhong.duan@oracle.com Subject: Re: [PATCH 1/3] retpolines: Only enable retpoline when compiler support it To: Peter Zijlstra , Masahiro Yamada Cc: Linux Kernel Mailing List , Ingo Molnar , Andy Lutomirski , konrad.wilk@oracle.com, David Woodhouse , Thomas Gleixner , srinivas.eeda@oracle.com, Borislav Petkov , Daniel Borkmann , Michal Marek , "H. Peter Anvin" References: <20181030100954.GF744@hirez.programming.kicks-ass.net> From: Zhenzhong Duan Organization: Oracle Message-ID: <1e62b1b7-8c37-b9a1-bcda-41aa99155420@oracle.com> Date: Wed, 31 Oct 2018 13:55:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181030100954.GF744@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9062 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=948 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310049 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/30 18:09, Peter Zijlstra wrote: > On Tue, Oct 30, 2018 at 06:39:24PM +0900, Masahiro Yamada wrote: >> Hi, >> >> >> >> On Tue, Oct 30, 2018 at 3:57 PM Zhenzhong Duan >> wrote: >>> >>> Since retpoline capable compilers are widely available, make >>> CONFIG_RETPOLINE hard depend on it. >>> >>> Change KBUILD to use CONFIG_RETPOLINE_SUPPORT to avoid conflict with >>> CONFIG_RETPOLINE which is used by kernel. >>> >>> With all that stuff, the check of RETPOLINE is changed to >>> CONFIG_RETPOLINE. >>> >>> This change is based on suggestion in https://lkml.org/lkml/2018/9/18/1016 >>> >>> Signed-off-by: Zhenzhong Duan >>> Cc: Thomas Gleixner >>> Cc: Peter Zijlstra >>> Cc: Borislav Petkov >>> Cc: Daniel Borkmann >>> Cc: David Woodhouse >>> Cc: H. Peter Anvin >>> Cc: Ingo Molnar >>> Cc: Konrad Rzeszutek Wilk >>> Cc: Andy Lutomirski >>> Cc: Masahiro Yamada >>> Cc: Michal Marek >>> --- >> >> >> Instead of adding another CONFIG option, >> does it make sense to add compiler support checks >> to 'depends on' syntax ? >> >> >> config RETPOLINE >> bool "Avoid speculative indirect branches in kernel" >> depends on $(cc-option,-mindirect-branch=thunk-extern >> -mindirect-branch-register) || \ >> $(cc-option,-mretpoline-external-thunk) >> default y >> select STACK_VALIDATION if HAVE_STACK_VALIDATION Looks better, thanks for suggestion. > > That seems to be what we did for stackprotector, which is similar in > that it used to fail the build. So yes, this seems sane. Should I add a scripts/gcc-x86_64-has-retpoline.sh like what stackprotector does as below or there is a simpler way? config CC_HAS_SANE_STACKPROTECTOR bool default $(success,$(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC)) if 64BIT default $(success,$(srctree)/scripts/gcc-x86_32-has-stack-protector.sh $(CC)) help We have to make sure stack protector is unconditionally disabled if the compiler produces broken code. Thanks Zhenzhong