Received: by 10.213.65.68 with SMTP id h4csp1862584imn; Mon, 19 Mar 2018 15:34:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELsMj8w9xM/jEz+EGpQ1wVk5knlD7JW2tDIuXkrcHrgn7jcxrjiovfSDkhe04dxG8Y4Y9Yik X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr13759556pld.28.1521498883424; Mon, 19 Mar 2018 15:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498883; cv=none; d=google.com; s=arc-20160816; b=fm94lWgyn3Ek9Zz5CStglnyPq/1j9J2jlzQUmxR8vqZ2SUcoB+XGaD/LX+vMjE0LjB CV014lgStWz34/FyDHS4+FwzFCNsTKOzz9lHJ10K6vg3Dn5jffY94rpknX/7LH+uuWTH 1OKpwAlWnSP3KdKHX59jBpmhGRpIFXOCjFji2tmDsrzE5W14YzUhT0GU5PHSDJyNNyXE fxrYPpJyglbFifDJW8eMVut6QiBDaG93Zw019npDAa16hCETto87jXFBKKesl7f/W/aw 33OlgFNZHmND6iQVDQiz+s3Q+ZDvFKSxmUUPm4yRWp+7NSZF4nONmyCDVUTkIpbUutLv zKfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :references:subject:cc:to:from:date:user-agent:message-id :dkim-signature:arc-authentication-results; bh=Eq1Q22vAZKQbBSUa/jF8MJQCN4/eZozaF90smNTxXTs=; b=MXtNpClgvR1xBd4N+xgCv1ZxR8DoB4+PHrsw7XBTedp/W+6B2Jk4c1PVeWmnBC6kDJ As9tV0YhWguTYU23iK/x9MzDY8lomj9/U+aIDPS8E34sdJPrJNr4vhxBfRKiy5ePC7NX SlZBvB1ed+IuB8Qwr8EXBlmAWuK6SnTzU6QjbILeV28yRe+9dJ4NNwFhMdTc3gkmoVOs U7w7kgThufLaS5m2bsM7dBTU12irVm+6/6P48e3Sw3O+G3K0VFK8gZsBIFFrfjfULPj4 2SaD9Iqe4yqapMJW+x9yTmO4q09u8YvH14cHoDQ4Epj9nG+OGPidLgVTVYMvIa0TdxMo J1Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=mD8zN9CK; 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 t11si137960pgn.624.2018.03.19.15.34.27; Mon, 19 Mar 2018 15:34:43 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=mD8zN9CK; 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 S936681AbeCSWdV (ORCPT + 99 others); Mon, 19 Mar 2018 18:33:21 -0400 Received: from merlin.infradead.org ([205.233.59.134]:50880 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933449AbeCSPsF (ORCPT ); Mon, 19 Mar 2018 11:48:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Eq1Q22vAZKQbBSUa/jF8MJQCN4/eZozaF90smNTxXTs=; b=mD8zN9CKs/nUeqloHgxUWd67O7 fRvHbgiEpNdE9m7/FUFq7LaeY/AjWbBlcoGdjTOqepL8ORbOASwZt2FxZ/m/MAqOYSeC02sTPUQ/b OT4L+6h8ItJIX6BcE35Q+4fqPaZn3du2zJWO3kMlgPV3dIUK6qL4DHV4i6xU0Qr6wx8HKWY5SngtX IFG3T1mbwSb+bAq3ToJhC/QWKd/zPaqUw70SpBC8P7Z3LeOZ+FEf/JVqy7o0lA5NY8TalGesyhlS2 v+KmLp6WR56cze61YfIzBmqmtj3l91Qj7SL/p046EW5SNO9RMQagRyO+dGoC7mLXfRN3xzvD/6/nv QV0AlaRg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1exx0x-0003Kw-Ic; Mon, 19 Mar 2018 15:47:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 35BF9202A7DFF; Mon, 19 Mar 2018 16:47:57 +0100 (CET) Message-Id: <20180319154717.652679334@infradead.org> User-Agent: quilt/0.63-1 Date: Mon, 19 Mar 2018 16:41:25 +0100 From: Peter Zijlstra To: mingo@kernel.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, "Peter Zijlstra (Intel)" Subject: [PATCH 1/2] x86: Force asm-goto References: <20180319154124.337947038@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-x86-force-asm-goto.patch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to start using asm-goto to guarantee the absence of dynamic branches (and thus speculation). A primary prerequisite for this is of course that the compiler supports asm-goto. This effecively lifts the minimum GCC version to build an x86 kernel to gcc-4.5. Signed-off-by: Peter Zijlstra (Intel) --- Makefile | 13 +++++++------ arch/x86/Makefile | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) --- a/Makefile +++ b/Makefile @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) export RETPOLINE_CFLAGS +# check for 'asm goto' +ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + CC_HAVE_ASM_GOTO := 1 + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + ifeq ($(config-targets),1) # =========================================================================== # *config targets only - make sure prerequisites are updated, and descend @@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -l # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) -# check for 'asm goto' -ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO -endif - include scripts/Makefile.kcov include scripts/Makefile.gcc-plugins --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER endif endif +ifndef CC_HAVE_ASM_GOTO + $(error Compiler lacks asm-goto support.) +endif + # # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226). There's no way