Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbeACXK1 (ORCPT + 1 other); Wed, 3 Jan 2018 18:10:27 -0500 Received: from mga05.intel.com ([192.55.52.43]:58816 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbeACXJr (ORCPT ); Wed, 3 Jan 2018 18:09:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,504,1508828400"; d="scan'208";a="7663172" From: Andi Kleen To: tglx@linuxtronix.de Cc: torvalds@linux-foundation.org, gregkh@linux-foundation.org, dwmw@amazon.co.uk, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, dave.hansen@intel.com, Dave Hansen Subject: [PATCH 09/11] x86/retpoline: Finally enable retpoline for C code Date: Wed, 3 Jan 2018 15:09:32 -0800 Message-Id: <20180103230934.15788-10-andi@firstfloor.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180103230934.15788-1-andi@firstfloor.org> References: <20180103230934.15788-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Dave Hansen From: David Woodhouse Add retpoline compile option in Makefile Update Makefile with retpoline compile options. This requires a gcc with the retpoline compiler patches enabled. Print a warning when the compiler doesn't support retpoline [Originally from David and Tim, but hacked by AK] Signed-off-by: David Woodhouse Signed-off-by: Tim Chen --- arch/x86/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 3e73bc255e4e..dad4b24abdc9 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -230,6 +230,15 @@ KBUILD_CFLAGS += -Wno-sign-compare # KBUILD_CFLAGS += -fno-asynchronous-unwind-tables +# +RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern) +ifneq ($(RETPOLINE_CFLAGS),) + KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE + KBUILD_AFLAGS += -DRETPOLINE +else + $(warning Retpoline not supported in compiler. Kernel may be insecure.) +endif + archscripts: scripts_basic $(Q)$(MAKE) $(build)=arch/x86/tools relocs -- 2.14.3